From 007016ecd2fabf0bbe789ac6fc0ab6f827ff90b7 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 4 Jun 2009 00:51:02 +0000 Subject: Update svn properties. --- OpenSim/Framework/ICnmCache.cs | 882 ++++++++++++++++++++--------------------- 1 file changed, 441 insertions(+), 441 deletions(-) (limited to 'OpenSim/Framework/ICnmCache.cs') diff --git a/OpenSim/Framework/ICnmCache.cs b/OpenSim/Framework/ICnmCache.cs index cba8a7f..2f62189 100644 --- a/OpenSim/Framework/ICnmCache.cs +++ b/OpenSim/Framework/ICnmCache.cs @@ -1,441 +1,441 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; - -namespace OpenSim.Framework -{ - /// - /// Represent generic cache to store key/value pairs (elements) limited by time, size and count of elements. - /// - /// - /// The type of keys in the cache. - /// - /// - /// The type of values in the cache. - /// - /// - /// - /// Cache store limitations: - /// - /// - /// - /// Limitation - /// Description - /// - /// - /// Time - /// - /// Element that is not accessed through or in last are - /// removed from the cache automatically. Depending on implementation of the cache some of elements may stay longer in cache. - /// returns , if cache is limited by time. - /// - /// - /// - /// Count - /// - /// When adding an new element to cache that already have of elements, cache will remove less recently - /// used element(s) from the cache, until element fits to cache. - /// returns , if cache is limiting element count. - /// - /// - /// - /// Size - /// - /// - /// When adding an new element to cache that already have of elements, cache will remove less recently - /// used element(s) from the cache, until element fits to cache. - /// returns , if cache is limiting total size of elements. - /// Normally size is bytes used by element in the cache. But it can be any other suitable unit of measure. - /// - /// - /// - /// - /// - public interface ICnmCache : IEnumerable> - { - /// - /// Gets current count of elements stored to . - /// - /// - /// - /// When adding an new element to that is limiting element count, - /// will remove less recently used elements until it can fit an new element. - /// - /// - /// - /// - /// - /// - int Count { get; } - - /// - /// Gets or sets elements expiration time. - /// - /// - /// Elements expiration time. - /// - /// - /// - /// When element has been stored in longer than - /// and it is not accessed through method or element's value is - /// not replaced by method, then it is automatically removed from the - /// . - /// - /// - /// It is possible that implementation removes element before it's expiration time, - /// because total size or count of elements stored to cache is larger than or . - /// - /// - /// It is also possible that element stays in cache longer than . - /// - /// - /// Calling try to remove all elements that are expired. - /// - /// - /// To disable time limit in cache, set to . - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - TimeSpan ExpirationTime { get; set; } - - /// - /// Gets a value indicating whether or not access to the is synchronized (thread safe). - /// - /// - /// if access to the is synchronized (thread safe); - /// otherwise, . - /// - /// - /// - /// To get synchronized (thread safe) access to object, use - /// in class - /// to retrieve synchronized wrapper for object. - /// - /// - /// - /// - bool IsSynchronized { get; } - - /// - /// Gets a value indicating whether is limiting count of elements. - /// - /// - /// if the count of elements is limited; - /// otherwise, . - /// - /// - /// - /// When adding an new element to that is limiting element count, - /// will remove less recently used elements until it can fit an new element. - /// - /// - /// - /// - /// - /// - bool IsCountLimited { get; } - - /// - /// Gets a value indicating whether is limiting size of elements. - /// - /// - /// if the total size of elements is limited; - /// otherwise, . - /// - /// - /// - /// When adding an new element to that is limiting total size of elements, - /// will remove less recently used elements until it can fit an new element. - /// - /// - /// - /// - /// - /// - /// - bool IsSizeLimited { get; } - - /// - /// Gets a value indicating whether elements stored to have limited inactivity time. - /// - /// - /// if the has a fixed total size of elements; - /// otherwise, . - /// - /// - /// If have limited inactivity time and element is not accessed through - /// or methods in , then element is automatically removed from - /// the cache. Depending on implementation of the , some of the elements may - /// stay longer in cache. - /// - /// - /// - /// - /// - bool IsTimeLimited { get; } - - /// - /// Gets or sets maximal allowed count of elements that can be stored to . - /// - /// - /// , if is not limited by count of elements; - /// otherwise maximal allowed count of elements. - /// - /// - /// - /// When adding an new element to that is limiting element count, - /// will remove less recently used elements until it can fit an new element. - /// - /// - int MaxCount { get; set; } - - /// - /// Gets maximal allowed element size. - /// - /// - /// Maximal allowed element size. - /// - /// - /// - /// If element's size is larger than , then element is - /// not added to the . - /// - /// - /// - /// - /// - /// - long MaxElementSize { get; } - - /// - /// Gets or sets maximal allowed total size for elements stored to . - /// - /// - /// Maximal allowed total size for elements stored to . - /// - /// - /// - /// 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 that is limiting total size of elements, - /// will remove less recently used elements until it can fit an new element. - /// - /// - /// value is less than 0. - /// - /// - /// - long MaxSize { get; set; } - - /// - /// Gets total size of elements stored to . - /// - /// - /// Total size of elements stored to . - /// - /// - /// - /// Normally bytes, but can be any suitable unit of measure. - /// - /// - /// Element's size is given when element is added or replaced by method. - /// - /// - /// When adding an new element to that is limiting total size of elements, - /// will remove less recently used elements until it can fit an new element. - /// - /// - /// - /// - /// - /// - /// - long Size { get; } - - /// - /// Gets an object that can be used to synchronize access to the . - /// - /// - /// An object that can be used to synchronize access to the . - /// - /// - /// - /// To get synchronized (thread safe) access to , use - /// method to retrieve synchronized wrapper interface to - /// . - /// - /// - /// - /// - object SyncRoot { get; } - - /// - /// Removes all elements from the . - /// - /// - /// - /// - /// - /// - void Clear(); - - /// - /// Purge expired elements from the . - /// - /// - /// - /// Element becomes expired when last access time to it has been longer time than . - /// - /// - /// Depending on implementation, some of expired elements - /// may stay longer than in the cache. - /// - /// - /// - /// - /// - /// - /// - /// - /// - void PurgeExpired(); - - /// - /// Removes element associated with from the . - /// - /// - /// The key that is associated with element to remove from the . - /// - /// - /// is . - /// - /// - /// - /// - /// - /// - void Remove( TKey key ); - - /// - /// Removes elements that are associated with one of from the . - /// - /// - /// The keys that are associated with elements to remove from the . - /// - /// - /// is . - /// - /// - /// - /// - /// - /// - void RemoveRange( IEnumerable keys ); - - /// - /// Add or replace an element with the provided , and to - /// . - /// - /// - /// The object used as the key of the element. Can't be reference. - /// - /// - /// The object used as the value of the element to add or replace. is allowed. - /// - /// - /// The element's size. Normally bytes, but can be any suitable unit of measure. - /// - /// - /// if element has been added successfully to the ; - /// otherwise . - /// - /// - /// is . - /// - /// - /// The element's is less than 0. - /// - /// - /// - /// If element's is larger than , then element is - /// not added to the , however - possible older element is - /// removed from the . - /// - /// - /// When adding an new element to that is limiting total size of elements, - /// will remove less recently used elements until it can fit an new element. - /// - /// - /// When adding an new element to that is limiting element count, - /// will remove less recently used elements until it can fit an new element. - /// - /// - /// - /// - /// - /// - /// - /// - /// - bool Set( TKey key, TValue value, long size ); - - /// - /// Gets the associated with the specified . - /// - /// - /// if the contains an element with - /// the specified key; otherwise, . - /// - /// - /// The key whose to get. - /// - /// - /// When this method returns, the value associated with the specified , - /// if the is found; otherwise, the - /// default value for the type of the parameter. This parameter is passed uninitialized. - /// - /// - /// is . - /// - /// - /// - /// - /// - /// - bool TryGetValue( TKey key, out TValue value ); - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; + +namespace OpenSim.Framework +{ + /// + /// Represent generic cache to store key/value pairs (elements) limited by time, size and count of elements. + /// + /// + /// The type of keys in the cache. + /// + /// + /// The type of values in the cache. + /// + /// + /// + /// Cache store limitations: + /// + /// + /// + /// Limitation + /// Description + /// + /// + /// Time + /// + /// Element that is not accessed through or in last are + /// removed from the cache automatically. Depending on implementation of the cache some of elements may stay longer in cache. + /// returns , if cache is limited by time. + /// + /// + /// + /// Count + /// + /// When adding an new element to cache that already have of elements, cache will remove less recently + /// used element(s) from the cache, until element fits to cache. + /// returns , if cache is limiting element count. + /// + /// + /// + /// Size + /// + /// + /// When adding an new element to cache that already have of elements, cache will remove less recently + /// used element(s) from the cache, until element fits to cache. + /// returns , if cache is limiting total size of elements. + /// Normally size is bytes used by element in the cache. But it can be any other suitable unit of measure. + /// + /// + /// + /// + /// + public interface ICnmCache : IEnumerable> + { + /// + /// Gets current count of elements stored to . + /// + /// + /// + /// When adding an new element to that is limiting element count, + /// will remove less recently used elements until it can fit an new element. + /// + /// + /// + /// + /// + /// + int Count { get; } + + /// + /// Gets or sets elements expiration time. + /// + /// + /// Elements expiration time. + /// + /// + /// + /// When element has been stored in longer than + /// and it is not accessed through method or element's value is + /// not replaced by method, then it is automatically removed from the + /// . + /// + /// + /// It is possible that implementation removes element before it's expiration time, + /// because total size or count of elements stored to cache is larger than or . + /// + /// + /// It is also possible that element stays in cache longer than . + /// + /// + /// Calling try to remove all elements that are expired. + /// + /// + /// To disable time limit in cache, set to . + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + TimeSpan ExpirationTime { get; set; } + + /// + /// Gets a value indicating whether or not access to the is synchronized (thread safe). + /// + /// + /// if access to the is synchronized (thread safe); + /// otherwise, . + /// + /// + /// + /// To get synchronized (thread safe) access to object, use + /// in class + /// to retrieve synchronized wrapper for object. + /// + /// + /// + /// + bool IsSynchronized { get; } + + /// + /// Gets a value indicating whether is limiting count of elements. + /// + /// + /// if the count of elements is limited; + /// otherwise, . + /// + /// + /// + /// When adding an new element to that is limiting element count, + /// will remove less recently used elements until it can fit an new element. + /// + /// + /// + /// + /// + /// + bool IsCountLimited { get; } + + /// + /// Gets a value indicating whether is limiting size of elements. + /// + /// + /// if the total size of elements is limited; + /// otherwise, . + /// + /// + /// + /// When adding an new element to that is limiting total size of elements, + /// will remove less recently used elements until it can fit an new element. + /// + /// + /// + /// + /// + /// + /// + bool IsSizeLimited { get; } + + /// + /// Gets a value indicating whether elements stored to have limited inactivity time. + /// + /// + /// if the has a fixed total size of elements; + /// otherwise, . + /// + /// + /// If have limited inactivity time and element is not accessed through + /// or methods in , then element is automatically removed from + /// the cache. Depending on implementation of the , some of the elements may + /// stay longer in cache. + /// + /// + /// + /// + /// + bool IsTimeLimited { get; } + + /// + /// Gets or sets maximal allowed count of elements that can be stored to . + /// + /// + /// , if is not limited by count of elements; + /// otherwise maximal allowed count of elements. + /// + /// + /// + /// When adding an new element to that is limiting element count, + /// will remove less recently used elements until it can fit an new element. + /// + /// + int MaxCount { get; set; } + + /// + /// Gets maximal allowed element size. + /// + /// + /// Maximal allowed element size. + /// + /// + /// + /// If element's size is larger than , then element is + /// not added to the . + /// + /// + /// + /// + /// + /// + long MaxElementSize { get; } + + /// + /// Gets or sets maximal allowed total size for elements stored to . + /// + /// + /// Maximal allowed total size for elements stored to . + /// + /// + /// + /// 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 that is limiting total size of elements, + /// will remove less recently used elements until it can fit an new element. + /// + /// + /// value is less than 0. + /// + /// + /// + long MaxSize { get; set; } + + /// + /// Gets total size of elements stored to . + /// + /// + /// Total size of elements stored to . + /// + /// + /// + /// Normally bytes, but can be any suitable unit of measure. + /// + /// + /// Element's size is given when element is added or replaced by method. + /// + /// + /// When adding an new element to that is limiting total size of elements, + /// will remove less recently used elements until it can fit an new element. + /// + /// + /// + /// + /// + /// + /// + long Size { get; } + + /// + /// Gets an object that can be used to synchronize access to the . + /// + /// + /// An object that can be used to synchronize access to the . + /// + /// + /// + /// To get synchronized (thread safe) access to , use + /// method to retrieve synchronized wrapper interface to + /// . + /// + /// + /// + /// + object SyncRoot { get; } + + /// + /// Removes all elements from the . + /// + /// + /// + /// + /// + /// + void Clear(); + + /// + /// Purge expired elements from the . + /// + /// + /// + /// Element becomes expired when last access time to it has been longer time than . + /// + /// + /// Depending on implementation, some of expired elements + /// may stay longer than in the cache. + /// + /// + /// + /// + /// + /// + /// + /// + /// + void PurgeExpired(); + + /// + /// Removes element associated with from the . + /// + /// + /// The key that is associated with element to remove from the . + /// + /// + /// is . + /// + /// + /// + /// + /// + /// + void Remove( TKey key ); + + /// + /// Removes elements that are associated with one of from the . + /// + /// + /// The keys that are associated with elements to remove from the . + /// + /// + /// is . + /// + /// + /// + /// + /// + /// + void RemoveRange( IEnumerable keys ); + + /// + /// Add or replace an element with the provided , and to + /// . + /// + /// + /// The object used as the key of the element. Can't be reference. + /// + /// + /// The object used as the value of the element to add or replace. is allowed. + /// + /// + /// The element's size. Normally bytes, but can be any suitable unit of measure. + /// + /// + /// if element has been added successfully to the ; + /// otherwise . + /// + /// + /// is . + /// + /// + /// The element's is less than 0. + /// + /// + /// + /// If element's is larger than , then element is + /// not added to the , however - possible older element is + /// removed from the . + /// + /// + /// When adding an new element to that is limiting total size of elements, + /// will remove less recently used elements until it can fit an new element. + /// + /// + /// When adding an new element to that is limiting element count, + /// will remove less recently used elements until it can fit an new element. + /// + /// + /// + /// + /// + /// + /// + /// + /// + bool Set( TKey key, TValue value, long size ); + + /// + /// Gets the associated with the specified . + /// + /// + /// if the contains an element with + /// the specified key; otherwise, . + /// + /// + /// The key whose to get. + /// + /// + /// When this method returns, the value associated with the specified , + /// if the is found; otherwise, the + /// default value for the type of the parameter. This parameter is passed uninitialized. + /// + /// + /// is . + /// + /// + /// + /// + /// + /// + bool TryGetValue( TKey key, out TValue value ); + } +} -- cgit v1.1