memcache.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     begin       : Mon Jul 14 2008
00003     copyright   : (C) 2008 by Martin Preuss
00004     email       : martin@libchipcard.de
00005 
00006  ***************************************************************************
00007  *                                                                         *
00008  *   This library is free software; you can redistribute it and/or         *
00009  *   modify it under the terms of the GNU Lesser General Public            *
00010  *   License as published by the Free Software Foundation; either          *
00011  *   version 2.1 of the License, or (at your option) any later version.    *
00012  *                                                                         *
00013  *   This library is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00016  *   Lesser General Public License for more details.                       *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU Lesser General Public      *
00019  *   License along with this library; if not, write to the Free Software   *
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00021  *   MA  02111-1307  USA                                                   *
00022  *                                                                         *
00023  ***************************************************************************/
00024 
00025 #ifndef GWENHYWFAR_MEMCACHE_H
00026 #define GWENHYWFAR_MEMCACHE_H
00027 
00028 
00029 #include <gwenhywfar/gwenhywfarapi.h>
00030 
00031 #include <time.h>
00032 #include <inttypes.h>
00033 
00034 
00035 
00036 typedef struct GWEN_MEMCACHE_ENTRY GWEN_MEMCACHE_ENTRY;
00037 
00038 typedef struct GWEN_MEMCACHE GWEN_MEMCACHE;
00039 
00040 
00041 GWENHYWFAR_API 
00042 void GWEN_MemCacheEntry_free(GWEN_MEMCACHE_ENTRY *me);
00043 
00044 GWENHYWFAR_API 
00045 uint32_t GWEN_MemCacheEntry_GetId(GWEN_MEMCACHE_ENTRY *me);
00046 
00047 
00048 GWENHYWFAR_API
00049 void *GWEN_MemCacheEntry_GetDataPtr(GWEN_MEMCACHE_ENTRY *me);
00050 
00051 GWENHYWFAR_API 
00052 size_t GWEN_MemCacheEntry_GetDataLen(GWEN_MEMCACHE_ENTRY *me);
00053 
00054 GWENHYWFAR_API 
00055 int GWEN_MemCacheEntry_GetIsValid(const GWEN_MEMCACHE_ENTRY *me);
00056 
00057 GWENHYWFAR_API 
00058 void GWEN_MemCacheEntry_BeginUse(GWEN_MEMCACHE_ENTRY *me);
00059 
00060 GWENHYWFAR_API 
00061 void GWEN_MemCacheEntry_EndUse(GWEN_MEMCACHE_ENTRY *me);
00062 
00063 
00064 
00065 
00066 GWENHYWFAR_API 
00067 GWEN_MEMCACHE *GWEN_MemCache_new(size_t maxCacheMemory,
00068                                  uint32_t maxCacheEntries);
00069 
00070 GWENHYWFAR_API 
00071 void GWEN_MemCache_free(GWEN_MEMCACHE *mc);
00072 
00073 
00082 GWENHYWFAR_API 
00083 GWEN_MEMCACHE_ENTRY *GWEN_MemCache_FindEntry(GWEN_MEMCACHE *mc,
00084                                              uint32_t id);
00085 
00093 GWENHYWFAR_API 
00094 GWEN_MEMCACHE_ENTRY *GWEN_MemCache_CreateEntry(GWEN_MEMCACHE *mc,
00095                                                uint32_t id,
00096                                                void *dataPtr,
00097                                                size_t dataLen);
00098 
00107 GWENHYWFAR_API 
00108 void GWEN_MemCache_PurgeEntry(GWEN_MEMCACHE *mc,
00109                               uint32_t id);
00110 
00116 GWENHYWFAR_API 
00117 void GWEN_MemCache_PurgeEntries(GWEN_MEMCACHE *mc,
00118                                 uint32_t id, uint32_t mask);
00119 
00125 GWENHYWFAR_API 
00126 void GWEN_MemCache_Purge(GWEN_MEMCACHE *mc);
00127 
00128 
00129 
00130 
00131 
00132 #endif