| 388 | // entry for a given key will be removed, so this "leak" concern is assuming you don't have sufficient space to store |
| 389 | // an item for each possible key |
| 390 | template <class C> class RefCountCache |
| 391 | { |
| 392 | public: |
| 393 | // Constructor |
| 394 | RefCountCache(unsigned int num_partitions, int size = -1, int items = -1, ts::VersionNumber object_version = ts::VersionNumber(), |
| 395 | const std::string &metrics_prefix = ".refcountcache"); |
| 396 | // Destructor |
| 397 | ~RefCountCache(); |
| 398 | |
| 399 | // User interface to the cache |
| 400 | Ptr<C> get(uint64_t key); |
| 401 | void put(uint64_t key, C *item, int size = 0, ink_time_t expiry_time = -1); |
| 402 | void erase(uint64_t key); |
| 403 | void clear(); |
| 404 | |
| 405 | // Some methods to get some internal state |
| 406 | int partition_for_key(uint64_t key); |
| 407 | ts::shared_mutex &lock_for_key(uint64_t key); |
| 408 | size_t partition_count() const; |
| 409 | RefCountCachePartition<C> &get_partition(int pnum); |
| 410 | size_t count() const; |
| 411 | RefCountCacheHeader &get_header(); |
| 412 | RefCountCacheBlock *get_rsb(); |
| 413 | |
| 414 | private: |
| 415 | int max_size; // Total size |
| 416 | int max_items; // Total number of items allowed |
| 417 | unsigned int num_partitions; |
| 418 | std::vector<RefCountCachePartition<C> *> partitions; |
| 419 | // Header |
| 420 | RefCountCacheHeader header; // Our header |
| 421 | RefCountCacheBlock rsb; |
| 422 | }; |
| 423 | |
| 424 | template <class C> |
| 425 | RefCountCache<C>::RefCountCache(unsigned int num_partitions, int size, int items, ts::VersionNumber object_version, |
nothing calls this directly
no test coverage detected