acl
3.5.3.0
|
类 | |
struct | ACL_CACHE2_INFO |
struct | ACL_CACHE2 |
类型定义 | |
typedef struct ACL_CACHE2 | ACL_CACHE2 |
typedef struct ACL_CACHE2_INFO | ACL_CACHE2_INFO |
函数 | |
ACL_API ACL_CACHE2 * | acl_cache2_create (int max_size, void(*free_fn)(const ACL_CACHE2_INFO *, void *)) |
ACL_API void | acl_cache2_free (ACL_CACHE2 *cache2) |
ACL_API ACL_CACHE2_INFO * | acl_cache2_enter (ACL_CACHE2 *cache2, const char *key, void *value, int timeout) |
ACL_API void * | acl_cache2_find (ACL_CACHE2 *cache2, const char *key) |
ACL_API ACL_CACHE2_INFO * | acl_cache2_locate (ACL_CACHE2 *cache2, const char *key) |
ACL_API int | acl_cache2_delete (ACL_CACHE2 *cache2, ACL_CACHE2_INFO *info) |
ACL_API int | acl_cache2_delete2 (ACL_CACHE2 *cache2, const char *key) |
ACL_API int | acl_cache2_timeout (ACL_CACHE2 *cache2) |
ACL_API ACL_CACHE2_INFO * | acl_cache2_update2 (ACL_CACHE2 *cache2, ACL_CACHE2_INFO *info, int timeout) |
ACL_API ACL_CACHE2_INFO * | acl_cache2_update (ACL_CACHE2 *cache2, const char *key, int timeout) |
ACL_API ACL_CACHE2_INFO * | acl_cache2_upsert (ACL_CACHE2 *cache2, const char *key, void *value, int timeout, int *exist) |
ACL_API ACL_CACHE2_INFO * | acl_cache2_head (ACL_CACHE2 *cache2) |
ACL_API ACL_CACHE2_INFO * | acl_cache2_tail (ACL_CACHE2 *cache2) |
ACL_API void | acl_cache2_refer (ACL_CACHE2_INFO *info) |
ACL_API void | acl_cache2_refer2 (ACL_CACHE2 *cache2, const char *key) |
ACL_API void | acl_cache2_unrefer (ACL_CACHE2_INFO *info) |
ACL_API void | acl_cache2_unrefer2 (ACL_CACHE2 *cache2, const char *key) |
ACL_API void | acl_cache2_lock (ACL_CACHE2 *cache2) |
ACL_API void | acl_cache2_unlock (ACL_CACHE2 *cache2) |
ACL_API void | acl_cache2_walk (ACL_CACHE2 *cache2, void(*walk_fn)(ACL_CACHE2_INFO *, void *), void *arg) |
ACL_API int | acl_cache2_clean (ACL_CACHE2 *cache2, int force) |
ACL_API int | acl_cache2_size (ACL_CACHE2 *cache2) |
typedef struct ACL_CACHE2 ACL_CACHE2 |
在文件 acl_cache2.h 第 10 行定义.
typedef struct ACL_CACHE2_INFO ACL_CACHE2_INFO |
缓存池中存储的缓存对象
ACL_API int acl_cache2_clean | ( | ACL_CACHE2 * | cache2, |
int | force | ||
) |
清空缓存池中的缓存对象,如果某个缓存对象依然在被引用且非强制性删除,则将不会被清空
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
force | {int} 如果非0,则即使某个缓存对象的引用计数非0也会被删除 |
ACL_API ACL_CACHE2* acl_cache2_create | ( | int | max_size, |
void(*)(const ACL_CACHE2_INFO *, void *) | free_fn | ||
) |
创建一个缓存池,并设置每个缓存对象的最大缓存时长及该缓存池的空间容量限制
max_size | {int} 该缓存池的容量限制,若该值 <= 0,则内部不会限制缓存量 |
free_fn | {void (*)(void*)} 用户级的释放缓存对象的函数 |
ACL_API int acl_cache2_delete | ( | ACL_CACHE2 * | cache2, |
ACL_CACHE2_INFO * | info | ||
) |
从缓存池中删除某个缓存对象
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
info | {ACL_CACHE2_INFO*} 用户对象所依附的缓存信息对象 |
ACL_API int acl_cache2_delete2 | ( | ACL_CACHE2 * | cache2, |
const char * | key | ||
) |
从缓存池中删除某个缓存对象
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
key | {const char*} 健值 |
ACL_API ACL_CACHE2_INFO* acl_cache2_enter | ( | ACL_CACHE2 * | cache2, |
const char * | key, | ||
void * | value, | ||
int | timeout | ||
) |
向缓存池中添加被缓存的对象
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
key | {const char*} 缓存对象的健值 |
value | {void*} 动态缓存对象 |
timeout | {int} 每个缓存对象的缓存时长 |
ACL_API void* acl_cache2_find | ( | ACL_CACHE2 * | cache2, |
const char * | key | ||
) |
从缓存池中查找某个被缓存的对象
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
key | {const char*} 查询健 |
ACL_API void acl_cache2_free | ( | ACL_CACHE2 * | cache2 | ) |
释放一个缓存池
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
ACL_API ACL_CACHE2_INFO* acl_cache2_head | ( | ACL_CACHE2 * | cache2 | ) |
获取按时间排序后的头部对象,调用者可从 ACL_CACHE2_INFO::value 获得应用对象
cache2 | {ACL_CACHE2*} |
ACL_API ACL_CACHE2_INFO* acl_cache2_locate | ( | ACL_CACHE2 * | cache2, |
const char * | key | ||
) |
从缓存池中查找某个被缓存的对象所依附的缓存信息对象
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
key | {const char*} 查询健 |
ACL_API void acl_cache2_lock | ( | ACL_CACHE2 * | cache2 | ) |
加锁缓存池对象,在多线程时用
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
ACL_API void acl_cache2_refer | ( | ACL_CACHE2_INFO * | info | ) |
增加某缓存对象的引用计数,防止被提前删除
info | {ACL_CACHE2_INFO*} 用户对象所依附的缓存信息对象 |
ACL_API void acl_cache2_refer2 | ( | ACL_CACHE2 * | cache2, |
const char * | key | ||
) |
增加某缓存对象的引用计数,防止被提前删除
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
key | {const char*} |
ACL_API int acl_cache2_size | ( | ACL_CACHE2 * | cache2 | ) |
当前缓存池中缓存对象的个数
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
ACL_API ACL_CACHE2_INFO* acl_cache2_tail | ( | ACL_CACHE2 * | cache2 | ) |
获取按时间排序后的尾部对象,调用者可从 ACL_CACHE2_INFO::value 获得应用对象
cache2 | {ACL_CACHE2*} |
ACL_API int acl_cache2_timeout | ( | ACL_CACHE2 * | cache2 | ) |
使缓存池中的过期对象被自动删除
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
ACL_API void acl_cache2_unlock | ( | ACL_CACHE2 * | cache2 | ) |
解锁缓存池对象,在多线程时用
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
ACL_API void acl_cache2_unrefer | ( | ACL_CACHE2_INFO * | info | ) |
减少某缓存对象的引用计数
info | {ACL_CACHE2_INFO*} 用户对象所依附的缓存信息对象 |
ACL_API void acl_cache2_unrefer2 | ( | ACL_CACHE2 * | cache2, |
const char * | key | ||
) |
减少某缓存对象的引用计数
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
key | {const char*} |
ACL_API ACL_CACHE2_INFO* acl_cache2_update | ( | ACL_CACHE2 * | cache2, |
const char * | key, | ||
int | timeout | ||
) |
使某个缓存对象的缓存时间加长
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
key | {const char*} 健值 |
timeout | {int} 缓存时长(秒) |
ACL_API ACL_CACHE2_INFO* acl_cache2_update2 | ( | ACL_CACHE2 * | cache2, |
ACL_CACHE2_INFO * | info, | ||
int | timeout | ||
) |
使某个缓存对象的缓存时间加长
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
info | {ACL_CACHE2_INFO*} 缓存对象 |
timeout | {int} 缓存时长(秒) |
ACL_API ACL_CACHE2_INFO* acl_cache2_upsert | ( | ACL_CACHE2 * | cache2, |
const char * | key, | ||
void * | value, | ||
int | timeout, | ||
int * | exist | ||
) |
添加或更新缓存中的对象
key | {const char*} 缓存对象的健值 |
value | {void*} 动态缓存对象 |
timeout | {int} 每个缓存对象的缓存时长 |
exist | {int*} 非 NULL 时,如果新 key 存在则被置 1,否则置 0 |
ACL_API void acl_cache2_walk | ( | ACL_CACHE2 * | cache2, |
void(*)(ACL_CACHE2_INFO *, void *) | walk_fn, | ||
void * | arg | ||
) |
遍历缓存中的所有对象
cache2 | {ACL_CACHE2*} 缓存池对象句柄 |
walk_fn | {void (*)(ACL_CACHE2_INFO*, void*)} 遍历回调函数 |
arg | {void *} walk_fn()/2 中的第二个参数 |