How to implement a cache class that supports timeouts using new .Net 4 concurrent collections?
A cache class typically contains hundreds of thousands of records. A very large part of the cache can expire at the same time.
Unlike a typical web cache, which may decrease due to memory pressure, this class should automatically delete objects if they time out.
Why do you need to implement your own caching class? Isn't that a standard implementation? There's a whole new build designed for caching in .NET 4.0 . Example of caching a value for 10 minutes:
var cache = MemoryCache.Default; cache.Add("key", new object(), DateTime.Now.AddMinutes(10));
, . LRU . () (). , , -, O (1) . , , , . , .
. reset , ( ) ( ). LRU, . , , : . , , !
, LRU , , . , , .
Source: https://habr.com/ru/post/1752218/More articles:Is there a php function to turn an associative array into a bunch of query parameters? - phpHow many fields normally have in one table? - mysqlThe most efficient way to create proportional views is androidВозможно ли использовать readline вместо libedit в Python raw_input под OS X? - pythonAdding a style and removing a style for a widget in gwt - gwtInitial Data - iphoneBefore running the database model - databaseКак отобразить два столбца в запросе соединения, которые сопоставляются с одним столбцом во второй таблице - sqlMysql Indexes, how much can I add the most? - mysqlFitch Format Proofs - any automatic solvers around? - computer-scienceAll Articles