OpenSim
|
Cache element generation interface More...
Public Member Functions | |
void | Clear () |
Clear all elements from the generation and make generation new again. More... | |
bool | Contains (int bucketIndex, TKey key) |
Determines whether the IGeneration contains an element with the specific key. More... | |
void | MakeOld () |
Make from generation old generation. More... | |
bool | Remove (int bucketIndex, TKey key) |
Remove element associated with the key from the generation. More... | |
bool | Set (int bucketIndex, TKey key, TValue value, long size) |
Set or add element to generation. More... | |
bool | TryGetValue (int bucketIndex, TKey key, out TValue value, out long size) |
Try to get element associated with key. More... | |
Public Member Functions inherited from OpenSim.Framework.CnmMemoryCache< TKey, TValue > | |
CnmMemoryCache () | |
Initializes a new instance of the CnmMemoryCache{TKey,TValue} class. More... | |
CnmMemoryCache (long maximalSize) | |
Initializes a new instance of the CnmMemoryCache{TKey,TValue} class. More... | |
CnmMemoryCache (long maximalSize, int maximalCount) | |
Initializes a new instance of the CnmMemoryCache{TKey,TValue} class. More... | |
CnmMemoryCache (long maximalSize, int maximalCount, TimeSpan expirationTime) | |
Initializes a new instance of the CnmMemoryCache{TKey,TValue} class. More... | |
CnmMemoryCache (long maximalSize, int maximalCount, TimeSpan expirationTime, IEqualityComparer< TKey > comparer) | |
Initializes a new instance of the CnmMemoryCache{TKey,TValue} class. More... | |
void | Clear () |
Removes all elements from the ICnmCache{TKey,TValue}. More... | |
IEnumerator< KeyValuePair < TKey, TValue > > | GetEnumerator () |
Returns an enumerator that iterates through the elements stored to CnmMemoryCache{TKey,TValue}. More... | |
void | PurgeExpired () |
Purge expired elements from the ICnmCache{TKey,TValue}. More... | |
void | Remove (TKey key) |
Removes element associated with key from the ICnmCache{TKey,TValue}. More... | |
void | RemoveRange (IEnumerable< TKey > keys) |
Removes elements that are associated with one of keys from the ICnmCache{TKey,TValue}. More... | |
bool | Set (TKey key, TValue value, long size) |
Add or replace an element with the provided key , value and size to ICnmCache{TKey,TValue}. More... | |
bool | TryGetValue (TKey key, out TValue value) |
Gets the value associated with the specified key . More... | |
Properties | |
bool | AccessedSinceLastTimeCheck [get, set] |
Gets or sets a value indicating whether generation was accessed since last time check. More... | |
int | Count [get] |
Gets element count in generation. More... | |
DateTime | ExpirationTime [get, set] |
Gets or sets generation's expiration time. More... | |
long | Size [get] |
Gets size of data stored to generation. More... | |
Properties inherited from OpenSim.Framework.CnmMemoryCache< TKey, TValue > | |
int | Count [get] |
Gets current count of elements stored to ICnmCache{TKey,TValue}. More... | |
TimeSpan | ExpirationTime [get, set] |
Gets or sets elements expiration time. More... | |
bool | IsCountLimited [get] |
Gets a value indicating whether ICnmCache{TKey,TValue} is limiting count of elements. More... | |
bool | IsSizeLimited [get] |
Gets a value indicating whether ICnmCache{TKey,TValue} is limiting size of elements. More... | |
bool | IsSynchronized [get] |
Gets a value indicating whether or not access to the ICnmCache{TKey,TValue} is synchronized (thread safe). More... | |
bool | IsTimeLimited [get] |
Gets a value indicating whether elements stored to ICnmCache{TKey,TValue} have limited inactivity time. More... | |
int | MaxCount [get, set] |
Gets or sets maximal allowed count of elements that can be stored to ICnmCache{TKey,TValue}. More... | |
long | MaxElementSize [get, set] |
long | MaxSize [get, set] |
Gets or sets maximal allowed total size for elements stored to ICnmCache{TKey,TValue}. More... | |
long | Size [get] |
Gets total size of elements stored to ICnmCache{TKey,TValue}. More... | |
object | SyncRoot [get] |
Gets an object that can be used to synchronize access to the ICnmCache{TKey,TValue}. More... | |
Properties inherited from OpenSim.Framework.ICnmCache< TKey, TValue > | |
int | Count [get] |
Gets current count of elements stored to ICnmCache{TKey,TValue}. More... | |
TimeSpan | ExpirationTime [get, set] |
Gets or sets elements expiration time. More... | |
bool | IsSynchronized [get] |
Gets a value indicating whether or not access to the ICnmCache{TKey,TValue} is synchronized (thread safe). More... | |
bool | IsCountLimited [get] |
Gets a value indicating whether ICnmCache{TKey,TValue} is limiting count of elements. More... | |
bool | IsSizeLimited [get] |
Gets a value indicating whether ICnmCache{TKey,TValue} is limiting size of elements. More... | |
bool | IsTimeLimited [get] |
Gets a value indicating whether elements stored to ICnmCache{TKey,TValue} have limited inactivity time. More... | |
int | MaxCount [get, set] |
Gets or sets maximal allowed count of elements that can be stored to ICnmCache{TKey,TValue}. More... | |
long | MaxElementSize [get] |
long | MaxSize [get, set] |
Gets or sets maximal allowed total size for elements stored to ICnmCache{TKey,TValue}. More... | |
long | Size [get] |
Gets total size of elements stored to ICnmCache{TKey,TValue}. More... | |
object | SyncRoot [get] |
Gets an object that can be used to synchronize access to the ICnmCache{TKey,TValue}. More... | |
Additional Inherited Members | |
Public Attributes inherited from OpenSim.Framework.CnmMemoryCache< TKey, TValue > | |
const int | DefaultMaxCount = 4096 |
Default maximal count. More... | |
const long | DefaultMaxSize = 134217728 |
Default maximal size. More... | |
readonly IEqualityComparer< TKey > | Comparer |
Comparer used to compare element keys. More... | |
Static Public Attributes inherited from OpenSim.Framework.CnmMemoryCache< TKey, TValue > | |
static readonly TimeSpan | DefaultExpirationTime = TimeSpan.FromMinutes(30.0) |
Default expiration time. More... | |
static readonly TimeSpan | MinExpirationTime = TimeSpan.FromSeconds(10.0) |
Minimal allowed expiration time. More... | |
Protected Member Functions inherited from OpenSim.Framework.CnmMemoryCache< TKey, TValue > | |
virtual void | AddToNewGeneration (int bucketIndex, TKey key, TValue value, long size) |
Add element to new generation. More... | |
virtual int | GetBucketIndex (TKey key) |
virtual void | PurgeGeneration (IGeneration generation) |
Purge generation from the cache. More... | |
Cache element generation interface
Generation can hold limited count of elements and limited size of data.
There are two kind generations: "new generation" and "old generation(s)". All new elements are added to "new generation".
Definition at line 1172 of file CnmMemoryCache.cs.
void OpenSim.Framework.CnmMemoryCache< TKey, TValue >.IGeneration.Clear | ( | ) |
Clear all elements from the generation and make generation new again.
When generation is new, it is allowed to add new elements to it and TryGetValuedoesn't remove elements from it.
Implements OpenSim.Framework.ICnmCache< TKey, TValue >.
bool OpenSim.Framework.CnmMemoryCache< TKey, TValue >.IGeneration.Contains | ( | int | bucketIndex, |
TKey | key | ||
) |
Determines whether the IGeneration contains an element with the specific key.
bucketIndex | The bucket index for the key to locate in IGeneration. |
key | The key to locate in the IGeneration. |
void OpenSim.Framework.CnmMemoryCache< TKey, TValue >.IGeneration.MakeOld | ( | ) |
Make from generation old generation.
When generation is old, TryGetValue hit removes element from the generation.
bool OpenSim.Framework.CnmMemoryCache< TKey, TValue >.IGeneration.Remove | ( | int | bucketIndex, |
TKey | key | ||
) |
Remove element associated with the key from the generation.
bucketIndex | The element's bucket index. |
key | The element's key. |
bool OpenSim.Framework.CnmMemoryCache< TKey, TValue >.IGeneration.Set | ( | int | bucketIndex, |
TKey | key, | ||
TValue | value, | ||
long | size | ||
) |
Set or add element to generation.
bucketIndex | The element's bucket index. |
key | The element's key. |
value | The element's value. |
size | The element's size. |
If element was already existing in generation and new element size fits to collection limits, then it's value is replaced with new one and size information is updated. If element didn't exists in generation before, then generation must have empty space for a new element and size must fit generation's limits, before element is added to generation.
bool OpenSim.Framework.CnmMemoryCache< TKey, TValue >.IGeneration.TryGetValue | ( | int | bucketIndex, |
TKey | key, | ||
out TValue | value, | ||
out long | size | ||
) |
Try to get element associated with key.
bucketIndex | The element's bucket index. |
key | The element's key. |
value | The element's value. |
size | The element's size. |
If element is not found from generation then value and size are set to default value (default(TValue) and 0).
|
getset |
Gets or sets a value indicating whether generation was accessed since last time check.
Definition at line 1177 of file CnmMemoryCache.cs.
|
get |
Gets element count in generation.
Definition at line 1182 of file CnmMemoryCache.cs.
|
getset |
Gets or sets generation's expiration time.
Definition at line 1187 of file CnmMemoryCache.cs.
|
get |
Gets size of data stored to generation.
Definition at line 1192 of file CnmMemoryCache.cs.