ngx-cacheable
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -0,3 +1,5 @@ | ||
import { Subject } from 'rxjs'; | ||
import { ICacheable } from './common'; | ||
import { ICacheConfig } from './common/ICacheConfig'; | ||
export declare const promiseGlobalCacheBusterNotifier: Subject<void>; | ||
export declare function PCacheable(cacheConfig?: ICacheConfig): (_target: Object, _propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<ICacheable<Promise<any>>>) => TypedPropertyDescriptor<ICacheable<Promise<any>>>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var rxjs_1 = require("rxjs"); | ||
var cacheable_decorator_1 = require("./cacheable.decorator"); | ||
var common_1 = require("./common"); | ||
exports.promiseGlobalCacheBusterNotifier = new rxjs_1.Subject(); | ||
var removeCachePair = function (cachePairs, parameters, cacheConfig) { | ||
@@ -23,7 +23,7 @@ /** | ||
/** | ||
* subscribe to the globalCacheBuster | ||
* subscribe to the promiseGlobalCacheBusterNotifier | ||
* if a custom cacheBusterObserver is passed, subscribe to it as well | ||
* subscribe to the cacheBusterObserver and upon emission, clear all caches | ||
*/ | ||
rxjs_1.merge(cacheable_decorator_1.globalCacheBusterNotifier.asObservable(), cacheConfig.cacheBusterObserver | ||
rxjs_1.merge(exports.promiseGlobalCacheBusterNotifier.asObservable(), cacheConfig.cacheBusterObserver | ||
? cacheConfig.cacheBusterObserver | ||
@@ -30,0 +30,0 @@ : rxjs_1.empty()).subscribe(function (_) { |
@@ -46,5 +46,5 @@ "use strict"; | ||
var rxjs_1 = require("rxjs"); | ||
var cacheable_decorator_1 = require("./cacheable.decorator"); | ||
var promise_cacheable_decorator_1 = require("./promise.cacheable.decorator"); | ||
var promise_cache_buster_decorator_1 = require("./promise.cache-buster.decorator"); | ||
var promise_cacheable_decorator_1 = require("./promise.cacheable.decorator"); | ||
var promise_cacheable_decorator_2 = require("./promise.cacheable.decorator"); | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000; | ||
@@ -122,12 +122,12 @@ var cacheBusterNotifier = new rxjs_1.Subject(); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getData", null); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getDataWithParamsObj", null); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getDataAndReturnCachedStream", null); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
maxAge: 1500 | ||
@@ -137,3 +137,3 @@ }) | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
maxAge: 1500, | ||
@@ -144,3 +144,3 @@ slidingExpiration: true | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
maxCacheCount: 5 | ||
@@ -150,3 +150,3 @@ }) | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
maxAge: 1500, | ||
@@ -157,3 +157,3 @@ maxCacheCount: 5 | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
maxAge: 1500, | ||
@@ -165,3 +165,3 @@ maxCacheCount: 5, | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
cacheResolver: function (_oldParameters, newParameters) { | ||
@@ -173,3 +173,3 @@ return newParameters.find(function (param) { return !!param.straightToLastCache; }); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
shouldCacheDecider: function (response) { | ||
@@ -186,3 +186,3 @@ return response.payload === 'test'; | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable({ | ||
promise_cacheable_decorator_2.PCacheable({ | ||
cacheBusterObserver: cacheBusterNotifier.asObservable() | ||
@@ -192,6 +192,6 @@ }) | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getDataWithUndefinedParameter", null); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getDataWithMultipleUndefinedParameters", null); | ||
@@ -620,9 +620,9 @@ return Service; | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getData1", null); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getData2", null); | ||
__decorate([ | ||
promise_cacheable_decorator_1.PCacheable() | ||
promise_cacheable_decorator_2.PCacheable() | ||
], Service.prototype, "getData3", null); | ||
@@ -673,3 +673,3 @@ return Service; | ||
*/ | ||
cacheable_decorator_1.globalCacheBusterNotifier.next(); | ||
promise_cacheable_decorator_1.promiseGlobalCacheBusterNotifier.next(); | ||
return [4 /*yield*/, (service.getData1('test1'))]; | ||
@@ -676,0 +676,0 @@ case 7: |
{ | ||
"name": "ngx-cacheable", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Rx Observable cache decorator", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { Subject } from 'rxjs'; | ||
import { globalCacheBusterNotifier } from './cacheable.decorator'; | ||
import { promiseGlobalCacheBusterNotifier } from './promise.cacheable.decorator'; | ||
import { PCacheBuster } from './promise.cache-buster.decorator'; | ||
@@ -543,3 +543,3 @@ import { PCacheable } from './promise.cacheable.decorator'; | ||
*/ | ||
globalCacheBusterNotifier.next(); | ||
promiseGlobalCacheBusterNotifier.next(); | ||
@@ -546,0 +546,0 @@ await(service.getData1('test1')); |
@@ -1,6 +0,6 @@ | ||
import { empty, merge } from 'rxjs'; | ||
import { globalCacheBusterNotifier } from './cacheable.decorator'; | ||
import { empty, merge, Subject } from 'rxjs'; | ||
import { DEFAULT_CACHE_RESOLVER, ICacheable } from './common'; | ||
import { ICacheConfig } from './common/ICacheConfig'; | ||
import { ICachePair } from './common/ICachePair'; | ||
export const promiseGlobalCacheBusterNotifier = new Subject<void>(); | ||
@@ -32,3 +32,3 @@ const removeCachePair = <T>( | ||
/** | ||
* subscribe to the globalCacheBuster | ||
* subscribe to the promiseGlobalCacheBusterNotifier | ||
* if a custom cacheBusterObserver is passed, subscribe to it as well | ||
@@ -38,3 +38,3 @@ * subscribe to the cacheBusterObserver and upon emission, clear all caches | ||
merge( | ||
globalCacheBusterNotifier.asObservable(), | ||
promiseGlobalCacheBusterNotifier.asObservable(), | ||
cacheConfig.cacheBusterObserver | ||
@@ -41,0 +41,0 @@ ? cacheConfig.cacheBusterObserver |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198883
3441