OpenSim
|
Synchronized Cenome cache wrapper. More...
Public Member Functions | |
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 ICnmCache{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... | |
Static Public Member Functions | |
static ICnmCache< TKey, TValue > | Synchronized (ICnmCache< TKey, TValue > cache) |
Returns a ICnmCache{TKey,TValue} wrapper that is synchronized (thread safe). More... | |
Properties | |
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] |
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... | |
Synchronized Cenome cache wrapper.
TKey | The type of keys in the cache. |
TValue | The type of values in the cache. |
Enumerator will block other threads, until enumerator's IDisposable.Dispose method is called. "foreach" statement is automatically calling it.
Definition at line 50 of file CnmSynchronizedCache.cs.
|
inline |
Removes all elements from the ICnmCache{TKey,TValue}.
Implements OpenSim.Framework.ICnmCache< TKey, TValue >.
Definition at line 555 of file CnmSynchronizedCache.cs.
|
inline |
Returns an enumerator that iterates through the elements stored to ICnmCache{TKey,TValue}.
<filterpriority>1</filterpriority>
Definition at line 570 of file CnmSynchronizedCache.cs.
|
inline |
Purge expired elements from the ICnmCache{TKey,TValue}.
Element becomes expired when last access time to it has been longer time than ICnmCache{TKey,TValue}.ExpirationTime.
Depending on ICnmCache{TKey,TValue} implementation, some of expired elements may stay longer than ICnmCache{TKey,TValue}.ExpirationTime in the cache.
Implements OpenSim.Framework.ICnmCache< TKey, TValue >.
Definition at line 597 of file CnmSynchronizedCache.cs.
|
inline |
Removes element associated with key from the ICnmCache{TKey,TValue}.
key | The key that is associated with element to remove from the ICnmCache{TKey,TValue}. |
ArgumentNullException | key is . |
Implements OpenSim.Framework.ICnmCache< TKey, TValue >.
Definition at line 619 of file CnmSynchronizedCache.cs.
|
inline |
Removes elements that are associated with one of keys from the ICnmCache{TKey,TValue}.
keys | The keys that are associated with elements to remove from the ICnmCache{TKey,TValue}. |
ArgumentNullException | keys is . |
Implements OpenSim.Framework.ICnmCache< TKey, TValue >.
Definition at line 641 of file CnmSynchronizedCache.cs.
|
inline |
Add or replace an element with the provided key , value and size to ICnmCache{TKey,TValue}.
key | The object used as the key of the element. Can't be reference. |
value | The object used as the value of the element to add or replace. is allowed. |
size | The element's size. Normally bytes, but can be any suitable unit of measure. |
ArgumentNullException | key is . |
ArgumentOutOfRangeException | The element's size is less than 0. |
If element's size is larger than ICnmCache{TKey,TValue}.MaxElementSize, then element is not added to the ICnmCache{TKey,TValue}, however - possible older element is removed from the ICnmCache{TKey,TValue}.
When adding an new element to ICnmCache{TKey,TValue} that is limiting total size of elements, ICnmCache{TKey,TValue}will remove less recently used elements until it can fit an new element.
When adding an new element to ICnmCache{TKey,TValue} that is limiting element count, ICnmCache{TKey,TValue}will remove less recently used elements until it can fit an new element.
Implements OpenSim.Framework.ICnmCache< TKey, TValue >.
Definition at line 694 of file CnmSynchronizedCache.cs.
|
inlinestatic |
Returns a ICnmCache{TKey,TValue} wrapper that is synchronized (thread safe).
cache | The ICnmCache{TKey,TValue} to synchronize. |
ArgumentNullException | cache is null. |
Definition at line 87 of file CnmSynchronizedCache.cs.
|
inline |
Gets the value associated with the specified key .
key | The key whose value to get. |
value | When this method returns, the value associated with the specified key , if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
ArgumentNullException | key is . |
Implements OpenSim.Framework.ICnmCache< TKey, TValue >.
Definition at line 725 of file CnmSynchronizedCache.cs.
|
get |
Gets current count of elements stored to ICnmCache{TKey,TValue}.
When adding an new element to ICnmCache{TKey,TValue} that is limiting element count, ICnmCache{TKey,TValue} will remove less recently used elements until it can fit an new element.
Definition at line 226 of file CnmSynchronizedCache.cs.
|
getset |
Gets or sets elements expiration time.
Elements expiration time.
When element has been stored in ICnmCache{TKey,TValue} longer than ICnmCache{TKey,TValue}.ExpirationTime and it is not accessed through ICnmCache{TKey,TValue}.TryGetValue method or element's value is not replaced by ICnmCache{TKey,TValue}.Set method, then it is automatically removed from the ICnmCache{TKey,TValue}.
It is possible that ICnmCache{TKey,TValue} implementation removes element before it's expiration time, because total size or count of elements stored to cache is larger than ICnmCache{TKey,TValue}.MaxSize or ICnmCache{TKey,TValue}.MaxCount.
It is also possible that element stays in cache longer than ICnmCache{TKey,TValue}.ExpirationTime.
Calling ICnmCache{TKey,TValue}.PurgeExpired try to remove all elements that are expired.
To disable time limit in cache, set ICnmCache{TKey,TValue}.ExpirationTime to DateTime.MaxValue.
Definition at line 272 of file CnmSynchronizedCache.cs.
|
get |
Gets a value indicating whether ICnmCache{TKey,TValue} is limiting count of elements.
if the ICnmCache{TKey,TValue} count of elements is limited; otherwise, .
When adding an new element to ICnmCache{TKey,TValue} that is limiting element count, ICnmCache{TKey,TValue} will remove less recently used elements until it can fit an new element.
Definition at line 308 of file CnmSynchronizedCache.cs.
|
get |
Gets a value indicating whether ICnmCache{TKey,TValue} is limiting size of elements.
if the ICnmCache{TKey,TValue} total size of elements is limited; otherwise, .
When adding an new element to ICnmCache{TKey,TValue} that is limiting total size of elements, ICnmCache{TKey,TValue} will remove less recently used elements until it can fit an new element.
Definition at line 337 of file CnmSynchronizedCache.cs.
|
get |
Gets a value indicating whether or not access to the ICnmCache{TKey,TValue} is synchronized (thread safe).
if access to the ICnmCache{TKey,TValue} is synchronized (thread safe); otherwise, .
To get synchronized (thread safe) access to ICnmCache{TKey,TValue} object, use CnmSynchronizedCache{TKey,TValue}.Synchronized in CnmSynchronizedCache{TKey,TValue} class to retrieve synchronized wrapper for ICnmCache{TKey,TValue} object.
Definition at line 364 of file CnmSynchronizedCache.cs.
|
get |
Gets a value indicating whether elements stored to ICnmCache{TKey,TValue} have limited inactivity time.
if the ICnmCache{TKey,TValue} has a fixed total size of elements; otherwise, .
If ICnmCache{TKey,TValue} have limited inactivity time and element is not accessed through ICnmCache{TKey,TValue}.Set or ICnmCache{TKey,TValue}.TryGetValue methods in ICnmCache{TKey,TValue}.ExpirationTime , then element is automatically removed from the cache. Depending on implementation of the ICnmCache{TKey,TValue}, some of the elements may stay longer in cache.
Definition at line 386 of file CnmSynchronizedCache.cs.
|
getset |
Gets or sets maximal allowed count of elements that can be stored to ICnmCache{TKey,TValue}.
int.MaxValue, if ICnmCache{TKey,TValue} is not limited by count of elements; otherwise maximal allowed count of elements.
When adding an new element to ICnmCache{TKey,TValue} that is limiting element count, ICnmCache{TKey,TValue} will remove less recently used elements until it can fit an new element.
Definition at line 410 of file CnmSynchronizedCache.cs.
|
get |
Gets maximal allowed element size.
Maximal allowed element size.
If element's size is larger than ICnmCache{TKey,TValue}.MaxElementSize, then element is not added to the ICnmCache{TKey,TValue}.
Definition at line 445 of file CnmSynchronizedCache.cs.
|
getset |
Gets or sets maximal allowed total size for elements stored to ICnmCache{TKey,TValue}.
Maximal allowed total size for elements stored to ICnmCache{TKey,TValue}.
Normally size is total bytes used by elements in the cache. But it can be any other suitable unit of measure.
When adding an new element to ICnmCache{TKey,TValue} that is limiting total size of elements, ICnmCache{TKey,TValue} will remove less recently used elements until it can fit an new element.
ArgumentOutOfRangeException | value is less than 0. |
Definition at line 475 of file CnmSynchronizedCache.cs.
|
get |
Gets total size of elements stored to ICnmCache{TKey,TValue}.
Total size of elements stored to ICnmCache{TKey,TValue}.
Normally bytes, but can be any suitable unit of measure.
Element's size is given when element is added or replaced by ICnmCache{TKey,TValue}.Set method.
When adding an new element to ICnmCache{TKey,TValue} that is limiting total size of elements, ICnmCache{TKey,TValue} will remove less recently used elements until it can fit an new element.
Definition at line 517 of file CnmSynchronizedCache.cs.
|
get |
Gets an object that can be used to synchronize access to the ICnmCache{TKey,TValue}.
An object that can be used to synchronize access to the ICnmCache{TKey,TValue}.
To get synchronized (thread safe) access to ICnmCache{TKey,TValue}, use CnmSynchronizedCache{TKey,TValue} method CnmSynchronizedCache{TKey,TValue}.Synchronized to retrieve synchronized wrapper interface to ICnmCache{TKey,TValue}.
Definition at line 543 of file CnmSynchronizedCache.cs.