Comments (4)
I'm updating some things in cache-base now.
I think it should be a new method if we're going to still allow passing in multiple arguments to create the key:
I think we should just remove support for passing multiple arguments, and passing keys as an array, and just support strings. I've never really liked this feature, for the types of reasons you're pointing out. Currently, if the key is passed as more than one argument or an array of segments, it's joined into a dot-notated string anyway, which makes it hard to see the point of supporting that. In earlier versions of js, it was nice to be able to dynamically build up keys that way, but it's not necessary and complicates the code.
Closing, I don't think we'll add support for this, but I might want to add support for a similar feature using a different method.
from cache-base.
Good idea.
from cache-base.
I like this idea, but I think it should be a new method if we're going to still allow passing in multiple arguments to create the key:
app.get('foo', 'bar', 'baz');
That's a complicated case to figure out (e.g. is it using 'baz'
as the default for foo.bar
or the getting the value for foo.bar.baz
).
Something like app.getDefault()
or app.default()
might be good and it will indicate that the last value will always be the default if a value doesn't exist for the key created using the rest of the arguments.
The other option is to only allow 2 arguments to .get
where the first argument may be a string or an array and the second is the default value. I think this is how we use .get
most of the time anyway.
from cache-base.
I think this is how we use .get most of the time anyway.
Exactly, it's enough. Otherwise going to be too complicated.
from cache-base.
Related Issues (16)
- TODO: config-cache
- Support for TTL HOT 3
- Update `set-value` dependency to `3.0.1` or later HOT 1
- Failed to minify the code when run react-scripts build
- update set value HOT 1
- denial of service and may lead to remote code execution vulnerability HOT 18
- more real `.has` method? HOT 3
- [Security Vulnerability] in cache-base v1, v2 and v3 / used by Webpack HOT 1
- CVE-2021-23440 found in set-value dependency HOT 4
- Unset-value Vulnerability HOT 2
- add .union method
- fix documentation or make it real HOT 4
- Please tag version 0.8.4 HOT 1
- remove support for setting on the root of the cache HOT 2
- add `.default()` method HOT 2
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 cache-base.