6b566c2c3a
Pass battery of linting/vetting
sm2017-04-30 19:45:06 -07:00
f73e2280ec
Ensure onEvicted is run after DeleteLRUAmount, and don't allocate evicted items array if no onEvicted function is registered
Patrick Mylund Nielsen2017-04-19 10:26:35 -04:00
96426d0c5b
README.md: Remove the unprotected change example since it would actually need external synchronization
Patrick Mylund Nielsen2017-03-26 12:36:28 -04:00
dd1ed0ba63
README.md: Remove one level of indentation and increase 'recommended' cleanupInterval
Patrick Mylund Nielsen2017-03-26 12:30:15 -04:00
a2d8b56f0c
Make Items() return a copy rather than an unsynchronized reference to the underlying items map
Patrick Mylund Nielsen2016-11-25 13:56:11 -05:00
a45ed98559
Add benchmarks that use expiring items (time.Now calls) and rename BenchmarkDeleteExpired to BenchmarkDeleteExpiredLoop for clarity
Patrick Mylund Nielsen2015-11-30 10:45:30 -05:00
d600e983c2
For inclusion with upstream projection, Cache.New() has been reverted to its former argument list, and Cache.NewWithLRU() as been added to allow setting maxItems. cache_test has also been reverted.
Matt Keller2015-03-09 08:17:46 -04:00
bf414c412e
Performance was suffering with very large caches, when the cache was under maxItems pressure. Reverted the LRU handler back to the first iteration: lazy deletion via the janitor, with bulk removal.
Matt Keller2015-03-08 11:50:57 -04:00
f66ee0bbc6
Injected LRU capabilities that simply: * ensures that when an item is added, if the number of unexpired items >= maximum number of items specified, the oldest (based on ACCESS) is expired * when an item is "gotten", or "set", the access time is updated
Matt Keller2015-02-27 15:57:16 -05:00
7d1d6d6ae9
Note about needing explicit synchronization if you want to use the returned items map and its cache at the same time
Patrick Mylund Nielsen2013-08-08 15:10:54 -04:00
c383ebd2ba
Remove go doc-style reference from README since go doc now shows public methods from (private) embedded structs
Patrick Mylund Nielsen2013-08-08 15:01:48 -04:00
2fb27e8369
Change the names of the MutexMap benchmarks to RWMutex to clarify the changes to the map benchmarks and the cache itself
Patrick Mylund Nielsen2013-06-30 20:40:26 -04:00
155ab21e5d
Use an RWMutex in the cache-equivalent map tests now that the cache uses one
Patrick Mylund Nielsen2013-06-30 20:31:46 -04:00
3986bff69b
Don't keep the read lock after traversing the items map (before saving to the io.Writer) in Save
Patrick Mylund Nielsen2013-06-30 20:20:38 -04:00
5388b25b3b
Use an RWMutex instead of a Mutex, making Get a read operation only (this slightly changes the eviction behavior: lookup doesn't completely expunge an expired item, but the janitor still will at the next cleanup.) Also, use the same RWMutex in Load and Save (thanks, Alan Shreve)
Patrick Mylund Nielsen2013-06-30 20:11:57 -04:00
1140511315
Condense the reference in the README by removing the duplicate descriptions and providing one general one for all of them
Patrick Mylund Nielsen2013-04-18 15:24:40 -04:00
c9f5754801
Add O(1) ItemCount method to retrieve items currently in the cache map (whether expired and not cleaned up or not)
Patrick Mylund Nielsen2013-04-18 14:32:01 -04:00
525c0ccc26
Add CONTRIBUTORS file and 'and the go-cache contributors' bit to the copyright line in LICENSE
Patrick Mylund Nielsen2012-10-08 12:31:23 +02:00
72916cf4df
Update README to reflect API change: IncrementFloat now only works on float32 and float64, and the use of Decrement should be encouraged over Increment (with a negative number) since Increment converting a negative signed integer to an unsigned integer probably isn't the intended behavior
Patrick Mylund Nielsen2012-08-17 13:48:55 +02:00