Changeset 169 for trunk/include/lru_cache.h
- Timestamp:
- 03/03/10 14:24:58 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/lru_cache.h
r168 r169 1 /** 2 * @file 3 * 4 * Copyright (C) 2008-2009 Timothy D. Morgan 1 /* 2 * Copyright (C) 2008-2010 Timothy D. Morgan 5 3 * 6 4 * This program is free software; you can redistribute it and/or modify … … 19 17 * $Id$ 20 18 */ 19 20 /** 21 * @file 22 * 23 * A data structure which approximates a least recently used (LRU) cache. 24 * Implemented as a basic randomized hash table. 25 */ 26 21 27 22 28 #ifndef LRU_CACHE_H … … 44 50 }; 45 51 52 53 /** XXX: document this. */ 46 54 typedef struct _lru_cache 47 55 { … … 57 65 58 66 67 /** 68 * XXX: finish documenting. 69 */ 59 70 lru_cache* lru_cache_create(uint32_t max_keys, uint32_t secret); 71 72 73 /** 74 * XXX: finish documenting. 75 */ 60 76 lru_cache* lru_cache_create_ctx(void* talloc_ctx, uint32_t max_keys, 61 77 uint32_t secret, bool talloc_data); 78 79 80 /** 81 * XXX: finish documenting. 82 */ 62 83 void lru_cache_destroy(lru_cache* ht); 63 84 64 /* 65 * 85 86 /** 87 * XXX: finish documenting. 66 88 */ 67 89 bool lru_cache_update(lru_cache* ht, const void* index, 68 90 uint32_t index_len, void* data); 69 91 70 /* Returns pointer to data previously stored at index. 71 * If no data was found at index, NULL is returned. 92 /** 93 * XXX: finish documenting. 94 * 95 * @return A pointer to data previously stored at index. 96 * If no data was found at index, NULL is returned. 72 97 */ 73 98 void* lru_cache_find(lru_cache* ht, const void* index, 74 99 uint32_t index_len); 75 100 76 /* Removes entry from table at index. 77 * Returns pointer to data that was there previously. 78 * Returns NULL if no entry is at index. 101 /** 102 * XXX: finish documenting. 103 * 104 * Removes entry from table at index. 105 * 106 * @return A pointer to data that was there previously or NULL if no entry is 107 * at index. 79 108 */ 80 109 bool lru_cache_remove(lru_cache* ht, const void* index,
Note: See TracChangeset
for help on using the changeset viewer.