Comments (9)
ok, the bolt example looks very good!
from ttlcache.
Regarding the SimpleCache
question: As an outsider shopping around for caches and reading your README and godoc, I don't see what SimpleCache
provides. I can see that Cache
implements it. Am I also supposed to implement it if I wanted... something? A different backend? But then I'd just use a different cache.
Unless I'm missing something, I don't think it's useful. (If it's just intended as a tidy collection of the available methods, it's not needed.)
from ttlcache.
The v3 has been released.
from ttlcache.
Being forced to move away from the ReneKroon cache now. It's quite a hassle changing my code to work with this repo. I wish there was a SimpleCache.
from ttlcache.
These sound like solid improvements. Maybe leave the SimpleCache in the front example so that it's easy for people to get started?
from ttlcache.
Do you mean leave the SimpleCache interface only as an example in the README? If so, I don't think that would give much value, since all the exported methods can be seen on the godoc page. Knowing those methods, it's not hard to design your own interface that contains only the methods you need (e.g. only Set and Purge).
from ttlcache.
I do think it lowers the entry barrier for people looking 'just a cache with TTL' to seconds instead of having to study the docs. I think it's an easy way to improve exposure of the library.
from ttlcache.
Sooner or later one would have to study the docs to know how to properly use the library. However, having a few good examples that show the basic and advanced usage, like now, is useful. I'm not suggesting these examples should be removed, I just don't see how they can be better with an interface defined in them. If anything, having too much information like this increases the confusion (what if the user doesn't want to use an interface at all?) That's why the examples should be simple and to the point: they should show the usage of the most important methods, not how they can be used with other language elements. After all, if one is using go, they should already know how things like methods and interfaces work.
What I am proposing we should have is a straightforward README file with code that is somewhat similar to bolt's: https://github.com/boltdb/bolt
from ttlcache.
I also think we should have only one Get
method that returns an exported *Item
(its fields would remain unexported, but their accessor methods would be exported). This way we wouldn't have to create a new GetX
method each time a new piece of data is needed (e.g. ttl -> GetWithTTL
). How does that sound @ReneKroon?
from ttlcache.
Related Issues (20)
- Add a method that activates transaction mode
- Add Version method to item type HOT 1
- Returning loader errors HOT 11
- Limit on no. of keys stored in ttlcache? HOT 12
- Migrating from ReneKroon HOT 3
- Enhancement Req - Add option to the cache to prevent updates when using Set() HOT 4
- RFC - Expiry based on passed in function (option during cache creation) HOT 2
- Provides similar implementation as sync.Map (LoadOrStore, LoadAndDelete)
- Auxiliary data with the cache so that LoaderFunc can be versatile HOT 3
- Get, Set, and Loader should include context.Context in function signature HOT 5
- Memory leak problem caused by deleting items from golang map HOT 3
- SuppressedLoader should allow setting `group` HOT 9
- OnEviction doesn't work as expected HOT 1
- Add MGet or Multiple Get to improve read performance HOT 2
- Cache Sharding support to increase performance
- Add an option for cache to not expire until background refresh completes HOT 5
- Mention DefaultTTL and NoTTL in Set() docs HOT 4
- Ensure that GetOrSet and GetAndDelete are properly locked HOT 2
- How to get cache value without "Automatic expiration time extension"? HOT 1
- Add a method to check if a key exists HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ttlcache.