#ifndef AWS_COMMON_CACHE_H
#define AWS_COMMON_CACHE_H
#include <aws/common/linked_hash_table.h>
struct aws_cache;
struct aws_cache_vtable {
void (*destroy)(struct aws_cache *cache);
int (*find)(struct aws_cache *cache, const void *key, void **p_value);
int (*put)(struct aws_cache *cache, const void *key, void *p_value);
int (*remove)(struct aws_cache *cache, const void *key);
void (*clear)(struct aws_cache *cache);
size_t (*get_element_count)(const struct aws_cache *cache);
};
struct aws_cache {
struct aws_allocator *allocator;
const struct aws_cache_vtable *vtable;
struct aws_linked_hash_table table;
size_t max_items;
void *impl;
};
void aws_cache_base_default_destroy(struct aws_cache *cache);
int aws_cache_base_default_find(struct aws_cache *cache, const void *key, void **p_value);
int aws_cache_base_default_remove(struct aws_cache *cache, const void *key);
void aws_cache_base_default_clear(struct aws_cache *cache);
size_t aws_cache_base_default_get_element_count(const struct aws_cache *cache);
AWS_EXTERN_C_BEGIN
AWS_COMMON_API
void aws_cache_destroy(struct aws_cache *cache);
AWS_COMMON_API
int aws_cache_find(struct aws_cache *cache, const void *key, void **p_value);
AWS_COMMON_API
int aws_cache_put(struct aws_cache *cache, const void *key, void *p_value);
AWS_COMMON_API
int aws_cache_remove(struct aws_cache *cache, const void *key);
AWS_COMMON_API
void aws_cache_clear(struct aws_cache *cache);
AWS_COMMON_API
size_t aws_cache_get_element_count(const struct aws_cache *cache);
AWS_EXTERN_C_END
#endif