Woolz Image Processing  Version 1.7.5
AlcLRUCache.c File Reference

A cache allowing rank and key access to it's entries. The cache is maintained using a maximum number of items and maximum total entry size. More...

Functions

AlcLRUCacheAlcLRUCacheNew (unsigned int maxItem, size_t maxSz, AlcLRUCKeyFn keyFn, AlcLRUCCmpFn cmpFn, AlcLRUCUnlinkFn unlinkFn, AlcErrno *dstErr)
 Allocates a new least recent use removal cache. More...
 
void AlcLRUCacheFree (AlcLRUCache *cache, int unlink)
 Frees a least recent use removal cache. More...
 
void * AlcLRUCEntryGet (AlcLRUCache *cache, void *entry)
 Given a cache entry (with sufficient data in the entry for the cache key generation function) this function attempts to find a matching entry in the cache. The partical entry could for example contain only an identification string if that is all that is required for key generation and entry comparison. If the entry exists in the cache then it become the most recently used entry. See AlcLRUCEntryGetWithKey(). More...
 
void * AlcLRUCEntryGetWithKey (AlcLRUCache *cache, unsigned int key, void *entry)
 Given a cache entry with sufficient data in the entry for the cache key generation function, this function attempts to find the matching cache entry. The partical entry could for example contain only an identification string if that is all that is required for entry comparison. If The given key is used to search the cache for entries with the same key. These are then checked using the cache entry comparison function. If the entry exists in the cache then it become the most recently used entry. More...
 
AlcLRUCItemAlcLRUCEntryAdd (AlcLRUCache *cache, size_t entrySz, void *entry, int *dstNewFlg)
 Attempts to add the given entry to the cache. If the entry already exists in the cache then it become the most recently used entry, but is not modified. More...
 
AlcLRUCItemAlcLRUCEntryAddWithKey (AlcLRUCache *cache, size_t entrySz, void *entry, unsigned int key, int *dstNewFlg)
 Attempts to add the given entry to the cache. If the entry already exists in the cache then it become the most recently used entry. More...
 
void AlcLRUCEntryRemove (AlcLRUCache *cache, void *entry)
 Removes the matching cache entry from the queue. See AlcLRUCEntryGet() for the entry use. More...
 
void AlcLRUCEntryRemoveWithKey (AlcLRUCache *cache, unsigned int key, void *entry)
 Removes the matching cache entry from the queue. See AlcLRUCEntryGetWithKey() for the entry use. More...
 
void AlcLRUCEntryRemoveAll (AlcLRUCache *cache)
 Removes all cache entries. More...
 
unsigned int AlcLRUCKeyGetNHashItem (AlcLRUCache *cache, unsigned int key)
 Returns the number of items in the hash bin corresponding to the given item key value. This is probably only useful for debug and tuning. More...
 
void AlcLRUCacheMaxSz (AlcLRUCache *cache, size_t newMaxSz)
 Set a new maximum total cache entry size. More...
 
void AlcLRUCacheFacts (AlcLRUCache *cache, FILE *fP)
 Prints a dump of the current cache status to a file. This is only intended for debug and tuning. More...
 
AlcLRUCItemAlcLRUCItemFind (AlcLRUCache *cache, unsigned int key, void *entry)
 Finds the cache item which matches the given entry. More...
 

Detailed Description

A cache allowing rank and key access to it's entries. The cache is maintained using a maximum number of items and maximum total entry size.

Author
Bill Hill
Date
November 2011
Version
Id
068ef34604082c669ffb753a341caf4b1a5bbc9d
Address: MRC Human Genetics Unit, MRC Institute of Genetics and Molecular Medicine, University of Edinburgh, Western General Hospital, Edinburgh, EH4 2XU, UK.
Copyright (C), [2012], The University Court of the University of Edinburgh, Old College, Edinburgh, UK.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.