diff options
author | Daniele De Lorenzi <daniele.delorenzi@fastnetserv.net> | 2019-04-02 15:49:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-02 15:49:54 +0200 |
commit | e27022b69886a327205dcdd166d7ccef1d02bcd9 (patch) | |
tree | 8e7e1aa15bdff1f152befbe4c6c205e47dcd26e6 /src/lib/third_party/include/lruc.h | |
parent | c51405e99bae3217545fa34386987b839a8c68a6 (diff) | |
parent | 153c77c2cd28d52d6b459263dea3ce988ceccd3c (diff) |
Merge pull request #11 from ntop/dev
Add all dev branch modifications
Diffstat (limited to 'src/lib/third_party/include/lruc.h')
-rw-r--r-- | src/lib/third_party/include/lruc.h | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/lib/third_party/include/lruc.h b/src/lib/third_party/include/lruc.h deleted file mode 100644 index 55fb271fe..000000000 --- a/src/lib/third_party/include/lruc.h +++ /dev/null @@ -1,55 +0,0 @@ -#include <pthread.h> -#include <stdint.h> -#include <time.h> - -#ifndef __lruc_header__ -#define __lruc_header__ - -// ------------------------------------------ -// errors -// ------------------------------------------ -typedef enum { - LRUC_NO_ERROR = 0, - LRUC_MISSING_CACHE, - LRUC_MISSING_KEY, - LRUC_MISSING_VALUE, - LRUC_PTHREAD_ERROR, - LRUC_VALUE_TOO_LARGE -} lruc_error; - - -// ------------------------------------------ -// types -// ------------------------------------------ -typedef struct { - void *value; - void *key; - uint32_t value_length; - uint32_t key_length; - uint64_t access_count; - void *next; -} lruc_item; - -typedef struct { - lruc_item **items; - uint64_t access_count; - uint64_t free_memory; - uint64_t total_memory; - uint64_t average_item_length; - uint32_t hash_table_size; - time_t seed; - lruc_item *free_items; - pthread_mutex_t *mutex; -} lruc; - - -// ------------------------------------------ -// api -// ------------------------------------------ -lruc *lruc_new(uint64_t cache_size, uint32_t average_length); -lruc_error lruc_free(lruc *cache); -lruc_error lruc_set(lruc *cache, void *key, uint32_t key_length, void *value, uint32_t value_length); -lruc_error lruc_get(lruc *cache, void *key, uint32_t key_length, void **value); -lruc_error lruc_delete(lruc *cache, void *key, uint32_t key_length); - -#endif |