7ac151875f
Merge pull request #46 from alexedwards/master
Patrick Mylund Nielsen
2017-04-18 19:29:47 -04:00
ea4bd2a538
LICENSE: Update copyright years
Patrick Mylund Nielsen
2017-03-26 12:37:11 -04:00
96426d0c5b
README.md: Remove the unprotected change example since it would actually need external synchronization
Patrick Mylund Nielsen
2017-03-26 12:36:28 -04:00
dd1ed0ba63
README.md: Remove one level of indentation and increase 'recommended' cleanupInterval
Patrick Mylund Nielsen
2017-03-26 12:30:15 -04:00
8c11fe2df0
Add GetWithExpiration
Alex Edwards
2016-12-08 14:50:49 +01:00
e7a9def80f
Add SetDefault() for setting with the default expiration
Patrick Mylund Nielsen
2016-11-25 18:48:19 -05:00
52581776a3
LICENSE: Update copyright year
Patrick Mylund Nielsen
2016-11-25 14:18:09 -05:00
9e6d9117e7
Add 'inlining of expired' note to Items()
Patrick Mylund Nielsen
2016-11-25 13:57:39 -05:00
a2d8b56f0c
Make Items() return a copy rather than an unsynchronized reference to the underlying items map
Patrick Mylund Nielsen
2016-11-25 13:56:11 -05:00
1881a9bccb
Merge pull request #29 from darrenmcc/master
Patrick Mylund Nielsen
2016-01-27 12:00:04 -05:00
da6326cd69
added go syntax highlighting to README
Darren McCleary
2016-01-27 11:56:21 -05:00
5849ccb308
remove mu.RUnlock call from get
Patrick Mylund Nielsen
2016-01-08 15:02:42 -05:00
721cc9438c
Add BenchmarkRWMutexInterfaceMapGetString
Patrick Mylund Nielsen
2015-12-03 09:55:58 -05:00
8c41258ef3
Add BenchmarkRWMutexInterfaceMapGet
Patrick Mylund Nielsen
2015-12-03 09:40:14 -05:00
faf83836bd
Change GitHub repository URLs in README
Patrick Mylund Nielsen
2015-12-02 14:32:12 -05:00
66bf7b7a45
Update README to point to new repository URL
Patrick Mylund Nielsen
2015-12-01 11:18:46 -05:00
d461c5d2dd
'Inline' set in Set, and do time checks before the lock
Patrick Mylund Nielsen
2015-12-01 11:08:43 -05:00
76f1250a65
Make OnEvicted() a little faster
Patrick Mylund Nielsen
2015-11-30 16:18:49 -05:00
7c1e7f5829
go fmt
Patrick Mylund Nielsen
2015-11-30 16:04:57 -05:00
afadf13f9f
Back to UnixNano(), syscall dependency isn't worth a few nanoseconds better performance
Patrick Mylund Nielsen
2015-11-30 15:12:19 -05:00
f6cdd07cbb
Merge branch 'timeval'
Patrick Mylund Nielsen
2015-11-30 15:02:11 -05:00
2f0c74ebb8
Use intermediary timevals
Patrick Mylund Nielsen
2015-11-30 15:02:02 -05:00
2f60853f80
No need for emptyTime anymore
Patrick Mylund Nielsen
2015-11-30 14:49:18 -05:00
01842a547c
Use timevals
Patrick Mylund Nielsen
2015-11-30 14:47:22 -05:00
1924ec3baf
Remove expired() since it's no longer used (because of the inlining)
Patrick Mylund Nielsen
2015-11-30 14:14:52 -05:00
8084bd02b5
Inline expiration checks manually for performance
Patrick Mylund Nielsen
2015-11-30 14:12:45 -05:00
eb4f9f6b2f
Use UnixNano int64s instead of Time
Patrick Mylund Nielsen
2015-11-30 13:54:01 -05:00
31c7be0bed
'Inline' Get and Expired
Patrick Mylund Nielsen
2015-11-30 13:50:17 -05:00
4e0d34ef00
Only get the current time once in the DeleteExpired loop
Patrick Mylund Nielsen
2015-11-30 13:39:27 -05:00
a45ed98559
Add benchmarks that use expiring items (time.Now calls) and rename BenchmarkDeleteExpired to BenchmarkDeleteExpiredLoop for clarity
Patrick Mylund Nielsen
2015-11-30 10:45:30 -05:00
28ab885a1a
Make BenchmarkDeleteExpired more meaningful
Patrick Mylund Nielsen
2015-11-28 15:13:26 -05:00
cf4e165754
Add IncrementInt benchmark
Patrick Mylund Nielsen
2015-11-28 14:56:23 -05:00
901b2413ee
Improve cache locality by removing Item-related pointers
Patrick Mylund Nielsen
2015-11-28 14:47:46 -05:00
3d4d09ca0b
Add a benchmark for DeleteExpired()
Patrick Mylund Nielsen
2015-11-28 14:35:38 -05:00
0ba3e0049c
Update copyright years
Patrick Mylund Nielsen
2015-11-28 14:21:44 -05:00
ac0fcef49b
Clarify that the OnEvicted function isn't called when an item is overwritten
Patrick Mylund Nielsen
2015-11-28 12:27:08 -05:00
e9441b12e0
Add mutex-using test condition to TestOnEvicted
Patrick Mylund Nielsen
2015-11-28 12:22:52 -05:00
3f2c810ea1
Add OnEvicted()
Patrick Mylund Nielsen
2015-11-27 22:00:08 -05:00
a0136a8980
Don't expose the cache mutex
Patrick Mylund Nielsen
2015-11-27 13:03:24 -05:00
a122e14c4b
Merge pull request #23 from databus23/patch-1
Patrick Mylund Nielsen
2015-10-13 08:21:26 -04:00
fe045e4040
Fix leaking the janitor ticker when shutting down
Fabian Ruff
2015-10-13 12:55:54 +02:00
93d85800f2
README.md: Add missing 'time' import to example
Patrick Mylund Nielsen
2015-03-03 09:09:38 -05:00
8a2f4f19ef
go fmt
Patrick Mylund Nielsen
2014-12-22 02:48:52 -05:00
e3a846e1f9
Clarify what NoExpiration and DefaultExpiration are
Patrick Mylund Nielsen
2014-12-22 02:47:08 -05:00
a1dd6b7fff
s/NewFrom/NewFrom()/ in NewFrom doc
Patrick Mylund Nielsen
2014-12-22 02:39:59 -05:00
9ea75a8586
s/NewFrom/NewFrom()/ in Load/LoadFile/Save/SaveFile docs
Patrick Mylund Nielsen
2014-12-22 02:37:46 -05:00
873e78f0db
s/gob.Register/gob.Register()/ in NewFrom doc
Patrick Mylund Nielsen
2014-12-22 02:30:02 -05:00
bc36de7dec
Clarify NewFrom documentation on use cases
Patrick Mylund Nielsen
2014-12-22 02:15:12 -05:00
d68800e607
s/with the same caveats/subject to the same caveat/ in NewFrom doc
Patrick Mylund Nielsen
2014-12-22 02:09:42 -05:00
887753fa90
Refer to DeleteExpired as c.DeleteExpired()
Patrick Mylund Nielsen
2014-12-22 02:06:10 -05:00
888f396121
Update NewFrom doc to be consistent with New
Patrick Mylund Nielsen
2014-12-22 02:04:11 -05:00
32dd451b6d
README.md: Be consistent with NewFrom()
Patrick Mylund Nielsen
2014-12-22 01:59:29 -05:00
238c0209c0
New markdown README (thanks Jason Mooberry)
Patrick Mylund Nielsen
2014-12-22 01:55:57 -05:00
46827c6a61
Add NoExpiration and DefaultExpiration constants and use them (thanks to Jason Mooberry)
Patrick Mylund Nielsen
2014-12-22 01:46:22 -05:00
73a30b2033
Add NewFrom, and deprecate Save, SaveFile, Load, and LoadFile
Patrick Mylund Nielsen
2014-12-22 01:12:10 -05:00
ffd0b9e3ec
Move the unexportedShardedCache to sharded.go
Patrick Mylund Nielsen
2014-12-22 00:24:49 -05:00
6ea7e6fb42
Remove the pointless unexportedInterface
Patrick Mylund Nielsen
2014-12-22 00:12:48 -05:00
23b49bf74d
LICENSE: Remove sneaky space character
Patrick Mylund Nielsen
2014-12-22 00:01:09 -05:00
61ce35d44e
LICENSE: Update copyright to 2012-2014
Patrick Mylund Nielsen
2014-12-21 23:56:20 -05:00
8c0eccfc44
CONTRIBUTORS: Add Jason Mooberry
Patrick Mylund Nielsen
2014-12-21 23:51:48 -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 Nielsen
2013-08-08 15:10:54 -04:00
3ff6a5407e
Reference 'go doc' in the README
Patrick Mylund Nielsen
2013-08-08 15:02:23 -04:00
c383ebd2ba
Remove go doc-style reference from README since go doc now shows public methods from (private) embedded structs
Patrick Mylund Nielsen
2013-08-08 15:01:48 -04:00
e91e36d111
ItemCount() is equivalent to len(c.Items()), not len(c.Items)
Patrick Mylund Nielsen
2013-08-08 14:54:03 -04:00
fd89281dfd
s/field/fields/
Patrick Mylund Nielsen
2013-08-08 14:53:24 -04:00
f8cc27acbc
Export Item wrapping type, and add an Items() method to cache
Patrick Mylund Nielsen
2013-08-08 14:53:02 -04:00
baa5a64da4
Revert 3986bff for now
Patrick Mylund Nielsen
2013-06-30 22:05:40 -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 Nielsen
2013-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 Nielsen
2013-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 Nielsen
2013-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 Nielsen
2013-06-30 20:11:57 -04:00
1fc39f1402
Add ItemCount method description to README reference
Patrick Mylund Nielsen
2013-04-18 15:26:16 -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 Nielsen
2013-04-18 15:24:40 -04:00
739fb494dc
Update LICENSE file to 2012-2013
Patrick Mylund Nielsen
2013-04-18 14:35:10 -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 Nielsen
2013-04-18 14:32:01 -04:00
d5d03c28d4
Add specialized increment and decrement methods
Patrick Mylund Nielsen
2013-04-18 14:24:30 -04:00
b5601e904d
Clarify licensing on contributed code
Patrick Mylund Nielsen
2012-10-08 12:34:42 +02:00
525c0ccc26
Add CONTRIBUTORS file and 'and the go-cache contributors' bit to the copyright line in LICENSE
Patrick Mylund Nielsen
2012-10-08 12:31:23 +02:00
e30c8eff7a
Merge pull request #4 from temoto/patch-1
Patrick Mylund Nielsen
2012-10-08 03:27:04 -07:00
a768a84319
Save/LoadFile must close file
Sergey Shepelev
2012-09-19 03:25:42 +04: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 Nielsen
2012-08-17 13:48:55 +02:00
b3a957a46c
Handle float64 and int64 Increment/Decrement separately, and don't use Increment(-n) in Decrement to support uints
Patrick Mylund Nielsen
2012-08-17 13:39:02 +02:00
9cc10f6f2f
Use a type switch instead, and Use unexported NewSharded in test
Patrick Mylund Nielsen
2012-08-17 11:35:20 +02:00
13225a8ae4
Unexport the shardedcache interface and implementation until both the API and implementation are solid
Patrick Mylund Nielsen
2012-08-17 11:32:24 +02:00
15cda21ff4
Add an interface, embed the mutex, and unexport some unnecessarily exported fields
Patrick Mylund Nielsen
2012-07-04 19:34:37 +01:00
bf97a87cc7
Cleaner bucket selection
Patrick Mylund Nielsen
2012-06-22 09:33:27 +01:00
52c269d8ae
Testing a sharded cache. Could be useful for massively parallel applications
Patrick Mylund Nielsen
2012-06-22 09:24:09 +01:00
0f0584a805
Fix BenchmarkCacheSetDeleteSingleLock 'cheating' by unintentionally only locking once in the whole benchmark, rather than once per set and delete
Patrick Mylund Nielsen
2012-06-22 06:52:32 +01:00
0a962bf9eb
Keep the same tense in docstrings, and remove a little ambiguity
Patrick Mylund Nielsen
2012-06-22 04:24:48 +01:00
8f6294df58
Remove unused Version const
Patrick Mylund Nielsen
2012-06-22 04:10:33 +01:00
2b93e5eceb
Stay below 80 characters in width in the README as well
Patrick Mylund Nielsen
2012-06-22 04:04:21 +01:00