TSCache64
What: class
File: _Cache
Ancestor: TBase_Object
Layer: 1
Platforms: C++, C#, Javascript, Pascal (D2), PHP, Python
Defines a base abstract class for caching. It contains the following methods:
Read_Cache
int32 Read_Cache( void* Data, int64 Address, int64 Size )
function Read_Cache( var Data ; Address, Size : longint ) : longint
Reads up to Size bytes from the cache for the specified address. Returns the number
of bytes actually read (if 0 then the data was not cached). Cached data is copied
to Data.
Write_Cache
void Write_Cache( const void* Data, int64 Address, int64 Size )
procedure Write_Cache( const Data ; Address, Size : longint )
Writes to cache up to Size bytes from Data.
Clear
void Clear()
procedure Clear
Clears cache.
Initialize
void Initialize()
procedure Initialize
Initialize object.
Terminate
void Terminate()
procedure Terminate
Terminate object.
Trim
void Trim()
procedure Trim
Discards the oldest cache item.
Set_Max_Size
void Set_Max_Size( int32 Size )
procedure Set_Max_Size( Size : longint )
Sets maximum cache size in bytes. If this is more than is currently cached, some
cache is thrown away.
Get_Max_Size
int32 Get_Max_Size()
function Get_Max_Size : longint
Gets current maximum cache size in bytes.
Get_Size
int32 Get_Size()
function Get_Size : longint
Returns amount of currently cached data, in bytes.
Get_Stats
int32 Get_Stats( int32 Index, int32 &Address )
function Get_Stats( Index : longint ; var Address : longint ) : longint
Lock
bool Lock( int64 Address )
function Lock( Address : longint ) : boolean
Locks the data starting at the specified address into memory so that it is not thrown
away. Returns false if the specified data is not in the cache.
Unlock
bool Unlock( int64 Address )
function Unlock( Address : longint ) : boolean
Unlocks the data starting at the specified address in memory. Returns false if the
specified data is not in the cache, or if it is not locked.
Get_Hits
int32 Get_Hits()
function Get_Hits : longint
Returns the total cache read hits.
Get_Misses
int32 Get_Misses()
function Get_Misses : longint
Returns the total cache read misses.
Get_Writes
int32 Get_Writes()
function Get_Writes : longint
Returns the total cache writes.
Get_Turns
int32 Get_Turns()
function Get_Turns : longint
Returns the number of times that a cached item had to be discarded to make room for
a new item.
Get_Replacements
int32 Get_Replacements()
function Get_Replacements : longint
Returns the number of writes when the item was already in the cache.
Set_Hits
void Set_Hits( int32 Value )
procedure Set_Hits( Value : longint )
Sets the total cache read hits.
Set_Misses
void Set_Misses( int32 Value )
procedure Set_Misses( Value : longint )
Sets the total cache read misses.
Set_Writes
void Set_Writes( int32 Value ))
procedure Set_Writes( Value : longint )
Sets the total cache writes.
Set_Turns
void Set_Turns( int32 Value )
procedure Set_Turns( Value : longint )
Sets the number of times that a cached item had to be discarded to make room for
a new item.
Set_Replacements
void Set_Replacements( int32 Value )
procedure Set_Replacements( Value : longint )
Sets the number of writes when the item was already in the cache.
Hits
int32 Hits() { return Get_Hits(); }
property Hits : longint read Get_Hits write Set_Hits
Sets the total cache read hits.
Misses
int32 Misses() { return Get_Misses(); })
property Misses : longint read Get_Misses write Set_Misses
Sets the total cache read misses.
Writes
int32 Writes() { return Get_Writes(); }
property Writes : longint read Get_Writes write Set_Writes
Sets the total cache writes.
Turns
int32 Turns() { return Get_Turns(); }
property Turns : longint read Get_Turns write Set_Turns
Sets the number of times that a cached item had to be discarded to make room for
a new item.
Replacements
int32 Replacements() { return Get_Replacements(); }
property Replacements : longint read Get_Replacements write Set_Replacements
Sets the number of writes when the item was already in the cache.