[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 80

`type TResourceCache = class`
`protected`
`FItems: TAvgLvlTree;` |  |
`FDescriptors: TAvgLvlTree;` |  |
`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 - ocal 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;` |  |
`procedure Clear;` |  | Clear the current Resource Cache
`destructor Destroy; override;` |  |
`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`

The latest version of this document can be found at lazarus-ccr.sourceforge.net.