cache.h 953 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * =====================================================================================
  3. *
  4. * Filename: cache.h
  5. *
  6. * Description: A simple cache
  7. *
  8. * Version: 1.0
  9. * Created: 04/11/2013 02:30:46 PM
  10. * Revision: none
  11. * Compiler: gcc
  12. *
  13. * Author: Oliver Lorenz (ol), [email protected]
  14. * Company: https://olorenz.org
  15. * License: This is licensed under the same terms as uthash itself
  16. *
  17. * =====================================================================================
  18. */
  19. #ifndef _CACHE_
  20. #define _CACHE_
  21. struct foo_cache;
  22. extern int foo_cache_create(struct foo_cache **dst, const size_t capacity,
  23. void (*free_cb) (void *element));
  24. extern int foo_cache_delete(struct foo_cache *cache, int keep_data);
  25. extern int foo_cache_lookup(struct foo_cache *cache, char *key, void *result);
  26. extern int foo_cache_insert(struct foo_cache *cache, char *key, void *data);
  27. #endif