@live-change/dao 0.9.118 → 0.9.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/DaoCache.js +3 -0
  2. package/package.json +2 -2
package/lib/DaoCache.js CHANGED
@@ -100,6 +100,7 @@ const defaultSettings = {
100
100
  deleteStatsScore: 0.2,
101
101
  cleanInterval: 1000, // 1 second
102
102
  cacheAdaptationFactor: 0.5, // cache add adaptation factor
103
+ cacheFilter: (path) => true
103
104
  }
104
105
 
105
106
  class DaoCache extends EventEmitter {
@@ -224,6 +225,7 @@ class DaoCache extends EventEmitter {
224
225
  }
225
226
 
226
227
  observable(what) {
228
+ if(!this.settings.cacheFilter(what)) return this.dao.observable(what)
227
229
  //console.log("CACHE OBSERVABLE", what)
228
230
  const observable = this.dao.observable(what)
229
231
  const oldObserve = observable.observe
@@ -241,6 +243,7 @@ class DaoCache extends EventEmitter {
241
243
 
242
244
  get(what) {
243
245
  //console.log("CACHE GET", what)
246
+ if(!this.settings.cacheFilter(what)) return this.dao.get(what)
244
247
  const cacheState = this.getOrCreateCacheState(what)
245
248
  if(cacheState) {
246
249
  cacheState.noticeSingleRead()
package/package.json CHANGED
@@ -35,6 +35,6 @@
35
35
  "scripts": {
36
36
  "test": "NODE_ENV=test tape tests/*"
37
37
  },
38
- "version": "0.9.118",
39
- "gitHead": "bacf9b3b71c1bc883d650f3fa4baba0257099629"
38
+ "version": "0.9.119",
39
+ "gitHead": "b93111cbcd227526a64a46e14dda74adf03064fe"
40
40
  }