Karl Seguin
79f9dcde21
fewer defers, document DeletePrefix
2020-01-23 12:55:55 +08:00
Karl Seguin
04261a5282
Merge branch 'master' into DeletePrefix
2020-01-23 12:50:53 +08:00
Karl Seguin
569ae60338
Merge pull request #37 from aporeto-inc/pin-expect
...
fixed/module: expect needs to be on master
2020-01-23 11:44:58 +08:00
Antoine Mercadal
048ac0669f
fixed/module: expect needs to be on master
2020-01-22 19:35:19 -08:00
Karl Seguin
2ff4136636
Merge pull request #36 from aporeto-inc/go-modules
...
migrate to go modules
2020-01-23 11:19:07 +08:00
Antoine Mercadal
f79de0e254
migrate to go modules
2020-01-22 19:16:52 -08:00
Karl Seguin
356e164dd5
preliminary work on DeletePrefix
2020-01-23 10:27:12 +08:00
Karl Seguin
2ff889bcae
document Clear
2020-01-23 10:04:47 +08:00
Karl Seguin
46ec5d2257
explicitly state the thread-safety nature of the library
2020-01-23 09:38:19 +08:00
Karl Seguin
ec06cd93a0
Merge pull request #28 from buglloc/bucket_tests
...
Fixed bucket tests
2019-02-23 22:26:40 +07:00
Andrew Krasichkov
8d8b062716
fixed bucket tests
2019-02-14 15:54:01 +03:00
Karl Seguin
3385784411
Add cache.ItemCount() intt64 API
2019-01-26 12:33:50 +07:00
Karl Seguin
692cd618b2
guard access to item.promotions in LayeredCache, which was applied to Cache in 557d56ec6f
2018-12-27 22:54:50 +07:00
Karl Seguin
142396791e
Merge pull request #22 from alexejk/gcOnDelete
...
Calling OnDelete from gc()
2018-11-26 20:29:43 +07:00
Alexej Kubarev
243f5c8219
Fixes #21 . Callong OnDelete during gc()
2018-11-25 15:31:09 -08:00
Alexej Kubarev
7e55af0a9c
Small routine lock file upgrade
2018-11-25 15:29:47 -08:00
Karl Seguin
a317416755
Merge pull request #16 from alexejk/onremove
...
Support for OnDelete() callback
2018-07-22 11:17:02 +07:00
Alexej Kubarev
7421e2d7b4
Adding support for OnDelete callback function
...
OnDelete will receive an item that is being processed for deletion to support calling cleanup function specific to the item stored
2018-07-16 18:20:17 +02:00
Alexej Kubarev
72059a01e9
Adding missing ignore file to ensure vendor folder is not checked in
2018-07-16 18:18:51 +02:00
Alexej Kubarev
00324cb2d2
Adding dep dependency management files to utilize vendoring
2018-07-16 18:18:02 +02:00
Karl Seguin
b425c9ca00
Merge pull request #11 from EdwardBetts/spelling
...
correct spelling mistake
2017-09-04 13:47:32 +07:00
Edward Betts
0d05fa8278
correct spelling mistake
2017-09-01 11:40:44 +01:00
Karl Seguin
3ba9789cfd
Merge pull request #10 from heyitsanthony/test-races
...
fix data races in tests
2017-02-17 13:08:20 +07:00
Anthony Romano
b3c864ded7
cache: make Stop() synchronous and races in tests
...
worker goroutine running concurrently with tests would cause data race errors
when running tests with -race enabled.
2017-02-13 15:39:24 -08:00
Anthony Romano
c69270ce08
layeredcache: add Stop() and fix races in tests
...
worker goroutine running concurrently with tests would cause data race errors
when running tests with -race enabled.
2017-02-13 15:39:24 -08:00
Karl Seguin
12c7ffdc19
Merge pull request #9 from spicydog/patch-1
...
Fix an error in example "itemsToPrune"
2016-12-22 18:15:50 +07:00
spicydog
77679ba342
Fix an error in example "itemsToPrune"
...
itemsToPrune -> ItemsToPrune
2016-12-21 20:07:16 +10:00
Karl Seguin
a2d6215577
Merge pull request #8 from jdeppe-pivotal/master
...
Add a SecondaryCache which exposes the secondary part of a LayeredCache
2016-11-03 22:19:53 +07:00
Jens Deppe
a451d7262c
Integrate feedback and upstream fixes
...
- Ensure correct locking in GetOrCreateSecondaryCache
- Fetch now returns a *Item
2016-11-01 23:53:22 -07:00
Jens Deppe
d2c2442186
Merge remote-tracking branch 'seguin/master'
2016-11-01 20:33:44 -07:00
Karl Seguin
8adbb5637b
return *Item from layered cache fetch instead of interface{}
2016-11-02 09:34:09 +07:00
Jens Deppe
c1634a4d00
Add concept of a SecondaryCache which exposes the secondary part of a LayeredCache
2016-11-01 09:01:39 -07:00
Karl Seguin
2f6b517f7b
Merge pull request #6 from HasMatthew/nanosecond_ttl
...
Use nanosecond-resolution TTL instead of second-resolution.
2016-07-07 20:03:45 -07:00
Matthew Dale
162d4e27ca
Use nanosecond-resolution TTL instead of second-resolution.
2016-07-07 15:32:49 -07:00
Karl Seguin
ddcff8e624
Merge pull request #5 from dvdplm/master
...
Fetch does not return stale items
2016-02-05 22:16:17 +08:00
David Palm
3665b16e83
Better test
2016-02-05 14:34:58 +01:00
David Palm
d5307b40af
Fetch does not return stale items
2016-02-03 16:07:59 +01:00
Karl Seguin
74754c77cc
Partially fixing #3 .
...
On close, drain the deletables channel (unblocking an waiting goroutines) and
close deletables. Like Gets and Sets against a now-closed promotables,
this means any subsequent to Deletes from deletables will panic.
I'm still not sure that this is ccache's responsibility. If a client closes a DB
connection, we'd expect subsequent operations against the now-closed connection
to fail. My main problems with defer'ing a recover are:
1 - the performance overhead on every single get / set / delete
2 - not communicating with the caller that the requested operatin is no longer
valid.
2015-07-26 11:05:48 +08:00
Karl Seguin
bfa769c6b6
add Stop method to stop the background worker and make it possible for the GC to reap the object
2015-07-23 22:24:50 +08:00
Karl Seguin
41f1a3cfcb
gonna be one of those days...
2015-01-07 08:12:17 +07:00
Karl Seguin
f9c7f14b7b
Fetch's API wasn't usable. It returned different values types based on whether
...
the fetch was needed or not. It now behaves consistently (with itself and with
Get), returning an *Item.
2015-01-07 08:09:39 +07:00
Karl Seguin
6df1e24ae3
2 changes:
...
1 -
Previously, we determined if an item should be promoted in the main getter
thread. This required that we protect the item.promotions variable, as both
the getter and the worker were concurrently accessing it. This change pushes
the conditional promotion to the worker (from the getter's point of view, items
are always promoted). Since only the worker ever accesses .promotions, we no
longer must protect access to it.
2 -
The total size of the cache was being maintained by both the worker thread
and the calling code. This required that we protect access to cache.size. Now,
only the worker ever changes the size. While this simplifies much of the code,
it means that we can't easily replace an item (replacement either via Set or
Replace). A replcement now involves creating a new object and deleting the old
one (using the existing deletables and promotable infrastructure). The only
noticeable impact frmo this change is that, despite previous documentation,
Replace WILL cause the item to be promoted (but it still only does so if it
exists and it still doesn't extend the original TTL).
2014-12-28 11:11:32 +07:00
Karl Seguin
557d56ec6f
guard all access to item.promotions
2014-12-28 10:35:20 +07:00
Karl Seguin
c75dcd4c12
link to rcache
2014-12-06 17:19:23 +07:00
Karl Seguin
78e597cdae
replace is size-aware
2014-11-21 15:45:11 +07:00
Karl Seguin
41ccfbb39a
renamed MaxItems to MaxSize, updated readme
2014-11-21 15:06:27 +07:00
Karl Seguin
c810d4feb3
test + fix for actual size function
2014-11-21 14:59:04 +07:00
Karl Seguin
ff8727e847
initial work on tracking cache by item size
2014-11-21 14:39:25 +07:00
Karl Seguin
44cdb043d1
Move size tracking to a variable, away from simply using the length of the list.
...
This paves the way for more complex size tracking.
2014-11-20 07:03:59 +07:00
Karl Seguin
df2f8eb082
Added documentation.
...
Bucket and LayeredBucket are no longer exported.
2014-11-14 07:56:24 +07:00