acl
3.5.3.0
|
类 | |
struct | ACL_CACHE_INFO |
struct | ACL_CACHE |
类型定义 | |
typedef struct ACL_CACHE_INFO | ACL_CACHE_INFO |
typedef struct ACL_CACHE | ACL_CACHE |
函数 | |
ACL_API ACL_CACHE * | acl_cache_create (int max_size, int timeout, void(*free_fn)(const ACL_CACHE_INFO *, void *)) |
ACL_API void | acl_cache_free (ACL_CACHE *cache) |
ACL_API ACL_CACHE_INFO * | acl_cache_enter (ACL_CACHE *cache, const char *key, void *value) |
ACL_API void * | acl_cache_find (ACL_CACHE *cache, const char *key) |
ACL_API ACL_CACHE_INFO * | acl_cache_locate (ACL_CACHE *cache, const char *key) |
ACL_API int | acl_cache_delete (ACL_CACHE *cache, ACL_CACHE_INFO *info) |
ACL_API int | acl_cache_delete2 (ACL_CACHE *cache, const char *key) |
ACL_API int | acl_cache_timeout (ACL_CACHE *cache) |
ACL_API void | acl_cache_update2 (ACL_CACHE *cache, ACL_CACHE_INFO *info, int timeout) |
ACL_API void | acl_cache_update (ACL_CACHE *cache, const char *key, int timeout) |
ACL_API void | acl_cache_refer (ACL_CACHE_INFO *info) |
ACL_API void | acl_cache_refer2 (ACL_CACHE *cache, const char *key) |
ACL_API void | acl_cache_unrefer (ACL_CACHE_INFO *info) |
ACL_API void | acl_cache_unrefer2 (ACL_CACHE *cache, const char *key) |
ACL_API void | acl_cache_lock (ACL_CACHE *cache) |
ACL_API void | acl_cache_unlock (ACL_CACHE *cache) |
ACL_API void | acl_cache_walk (ACL_CACHE *cache, void(*walk_fn)(ACL_CACHE_INFO *, void *), void *arg) |
ACL_API int | acl_cache_clean (ACL_CACHE *cache, int force) |
ACL_API int | acl_cache_size (ACL_CACHE *cache) |
typedef struct ACL_CACHE_INFO ACL_CACHE_INFO |
缓存池中存储的缓存对象
ACL_API int acl_cache_clean | ( | ACL_CACHE * | cache, |
int | force | ||
) |
清空缓存池中的缓存对象,如果某个缓存对象依然在被引用且非强制性删除,则将不会被清空
cache | {ACL_CACHE*} 缓存池对象句柄 |
force | {int} 如果非0,则即使某个缓存对象的引用计数非0也会被删除 |
ACL_API ACL_CACHE* acl_cache_create | ( | int | max_size, |
int | timeout, | ||
void(*)(const ACL_CACHE_INFO *, void *) | free_fn | ||
) |
创建一个缓存池,并设置每个缓存对象的最大缓存时长及该缓存池的空间容量限制
max_size | {int} 该缓存池的容量限制 |
timeout | {int} 每个缓存对象的缓存时长 |
free_fn | {void (*)(void*)} 用户级的释放缓存对象的函数 |
ACL_API int acl_cache_delete | ( | ACL_CACHE * | cache, |
ACL_CACHE_INFO * | info | ||
) |
从缓存池中删除某个缓存对象
cache | {ACL_CACHE*} 缓存池对象句柄 |
info | {ACL_CACHE_INFO*} 用户对象所依附的缓存信息对象 |
ACL_API int acl_cache_delete2 | ( | ACL_CACHE * | cache, |
const char * | key | ||
) |
从缓存池中删除某个缓存对象
cache | {ACL_CACHE*} 缓存池对象句柄 |
key | {const char*} 健值 |
ACL_API ACL_CACHE_INFO* acl_cache_enter | ( | ACL_CACHE * | cache, |
const char * | key, | ||
void * | value | ||
) |
向缓存池中添加被缓存的对象
cache | {ACL_CACHE*} 缓存池对象句柄 |
key | {const char*} 缓存对象的健值 |
value | {void*} 动态缓存对象 |
ACL_API void* acl_cache_find | ( | ACL_CACHE * | cache, |
const char * | key | ||
) |
从缓存池中查找某个被缓存的对象
cache | {ACL_CACHE*} 缓存池对象句柄 |
key | {const char*} 查询健 |
ACL_API void acl_cache_free | ( | ACL_CACHE * | cache | ) |
释放一个缓存池,并自动调用 acl_cache_create()/3 中的释放函数释放缓存对象
cache | {ACL_CACHE*} 缓存池对象句柄 |
ACL_API ACL_CACHE_INFO* acl_cache_locate | ( | ACL_CACHE * | cache, |
const char * | key | ||
) |
从缓存池中查找某个被缓存的对象所依附的缓存信息对象
cache | {ACL_CACHE*} 缓存池对象句柄 |
key | {const char*} 查询健 |
ACL_API void acl_cache_lock | ( | ACL_CACHE * | cache | ) |
加锁缓存池对象,在多线程时用
cache | {ACL_CACHE*} 缓存池对象句柄 |
ACL_API void acl_cache_refer | ( | ACL_CACHE_INFO * | info | ) |
增加某缓存对象的引用计数,防止被提前删除
info | {ACL_CACHE_INFO*} 用户对象所依附的缓存信息对象 |
ACL_API void acl_cache_refer2 | ( | ACL_CACHE * | cache, |
const char * | key | ||
) |
增加某缓存对象的引用计数,防止被提前删除
cache | {ACL_CACHE*} 缓存池对象句柄 |
key | {const char*} |
ACL_API int acl_cache_size | ( | ACL_CACHE * | cache | ) |
当前缓存池中缓存对象的个数
cache | {ACL_CACHE*} 缓存池对象句柄 |
ACL_API int acl_cache_timeout | ( | ACL_CACHE * | cache | ) |
使缓存池中的过期对象被自动删除
cache | {ACL_CACHE*} 缓存池对象句柄 |
ACL_API void acl_cache_unlock | ( | ACL_CACHE * | cache | ) |
解锁缓存池对象,在多线程时用
cache | {ACL_CACHE*} 缓存池对象句柄 |
ACL_API void acl_cache_unrefer | ( | ACL_CACHE_INFO * | info | ) |
减少某缓存对象的引用计数
info | {ACL_CACHE_INFO*} 用户对象所依附的缓存信息对象 |
ACL_API void acl_cache_unrefer2 | ( | ACL_CACHE * | cache, |
const char * | key | ||
) |
减少某缓存对象的引用计数
cache | {ACL_CACHE*} 缓存池对象句柄 |
key | {const char*} |
ACL_API void acl_cache_update | ( | ACL_CACHE * | cache, |
const char * | key, | ||
int | timeout | ||
) |
使某个缓存对象的缓存时间加长
cache | {ACL_CACHE*} 缓存池对象句柄 |
key | {const char*} 健值 |
timeout | {int} 缓存时长(秒) |
ACL_API void acl_cache_update2 | ( | ACL_CACHE * | cache, |
ACL_CACHE_INFO * | info, | ||
int | timeout | ||
) |
使某个缓存对象的缓存时间加长
cache | {ACL_CACHE*} 缓存池对象句柄 |
info | {ACL_CACHE_INFO*} 缓存对象 |
timeout | {int} 缓存时长(秒) |
ACL_API void acl_cache_walk | ( | ACL_CACHE * | cache, |
void(*)(ACL_CACHE_INFO *, void *) | walk_fn, | ||
void * | arg | ||
) |
遍历缓存中的所有对象
cache | {ACL_CACHE*} 缓存池对象句柄 |
walk_fn | {void (*)(ACL_CACHE_INFO*, void*)} 遍历回调函数 |
arg | {void *} walk_fn()/2 中的第二个参数 |