Comments (2)
Of course we can make it LRU with fixed size. But there may be some issues hard to debug. I thinking about disabling cache totally. Generally it is for tracking instances:
post = new Post
post.save (err, p) ->
// here p and post of course same object (single pointer)
Post.find post.id, (err, p2) ->
// here p2 and post the same pointer
But without caching p2 and p1 not the same object, so you can modify both, then save and lost some changes. Let's say we have some case when cached object was removed from constructor.cache, but still used by application code, in the next time we call Model.find new instance will be saved in cache, both instances live. This is a reason why it should be touched carefully.
But more complicated saving logic looks like solition:
object.save ->
IF object in cache?
THEN
IF cached object the same pointer?
THEN just save
ELSE update cached object, merge pointers, save
ELSE reload from database to cached instance, object.save()
on updating cached instances, need track dirty attributes. now we only have problem in situation where both cached and not cached objects have modifications on same attribute.
what do you think?
from jugglingdb.
I think that unless you are guaranteed to be the only client of the database, you can never be sure that your cached object represents the current state of the database.
I think that all of these problems are preferable to my process crashing because it has run out of memory with cached objects!
from jugglingdb.
Related Issues (20)
- README documentation references are not reachable
- is this project dead ? HOT 5
- Potentially unhandled rejection [2] TypeError, when upgrading to new version of node. HOT 1
- Site down HOT 2
- Support multiple hooks per action
- Validations should be revisited
- Deprecate mutation features
- Consider removing all instance methods
- Disallow mixins on Model
- Model relations
- how to query field in multiple values? HOT 1
- Can i use JugglingDB in production? HOT 4
- process rpc message error TypeError: User.bulkUpdate is not a function HOT 2
- How can i delete one record ?
- Is this project maintained? HOT 2
- How to get the table definition from a datasource?
- upsert method doesn't trigger any hooks for mysql adapter HOT 3
- In
- Use in production? HOT 2
- Composite primary keys / composite foreign keys
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 jugglingdb.