[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'LCLResCache' (#lcl)

# TResourceCache

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TResourceCache - a cache (linked list) for storing Resources.

## Declaration

Source position: lclrescache.pas line 78

`type TResourceCache = class`
`protected`
`FItems: TAvlTree;`
`FDescriptors: TAvlTree;`
`FDestroying: Boolean;` |  | FDestroying - local boolean variable to store Destroying status.
`FResourceCacheDescriptorClass: TResourceCacheDescriptorClass;` |  | FResourceCacheDescriptorClass - local variable for holding the class of the current descriptor.
`FResourceCacheItemClass: TResourceCacheItemClass;` |  | FResourceCacheItemClass - local variable for holding the class of the current cache item.
`FMaxUnusedItem: Integer;` |  | FMaxUnusedItem - how many freed resources to keep.
`FFirstUnusedItem: TResourceCacheItem;` |  | FFirstUnusedItem - local variable storing location of first free item.
`FLastUnusedItem: TResourceCacheItem;` |  | FLastUnusedItem - local variable storing location of last free item.
`FUnUsedItemCount: Integer;` |  | FUnUsedItemCount - local variable with count of free items.
`FLock: TCriticalSection;`
`procedure RemoveItem(); virtual;` |  | RemoveItem from CacheItem list.
`procedure RemoveDescriptor(); virtual;` |  | RemoveDescriptor from Cache Descriptor list.
`procedure ItemUsed();` |  | ItemUsed - method for signalling that the specified Item is being used.
`procedure ItemUnused();` |  | ItemUnused - method for signalling that the specified Item is unused.
`function ItemIsUsed();` |  | ItemIsUsed - returns True if specified Item is being used.
`public`
`constructor Create;` |  | Constructor for the class instance.
`procedure Clear;` |  | Clears the current entries in the Resource Cache.
`destructor Destroy; override;` |  | Destructor for the class instance.
`function CompareItems(); virtual;` |  | CompareItems - returns 0 if items are equal, -1 if Item1 is less, 1 if Item1 is greater.
`function CompareDescriptors(); virtual; abstract;` |  | CompareDescriptors - returns 0 if descriptors are equal, -1 if Desc1 is less, 1 if Desc1 is greater.
`procedure ConsistencyCheck;` |  | ConsistencyCheck - checks that Items have valid descriptors.
`procedure Lock;`
`procedure Unlock;`
`property MaxUnusedItem: Integer; [rw]` |  | MaxUnusedItem - the largest permitted number of unused items.
`property ResourceCacheItemClass: TResourceCacheItemClass; [r]` |  | ResourceCacheItemClass - the Class of the current Cache Item.
`property ResourceCacheDescriptorClass: TResourceCacheDescriptorClass; [r]` |  | ResourceCacheDescriptorClass - the class of the current cache item descriptor.
`end;`

## Inheritance

`TResourceCache` |  | TResourceCache - a cache (linked list) for storing Resources.
`TObject`