angelnikolov/ts-cacheable

cacheBusterObserver with maxCacheCount

Closed this issue · 2 comments

when you bust the cache, you bust it for all.

merge(
        globalCacheBusterNotifier.asObservable(),
        cacheConfig.cacheBusterObserver
          ? cacheConfig.cacheBusterObserver
          : empty()
      ).subscribe(_ => {
        storageStrategy.removeAll(cacheKey);
        pendingCachePairs.length = 0;
      });

for maxCacheCount you remove one:

if (
                  !cacheConfig.maxCacheCount ||
                  cacheConfig.maxCacheCount === 1 ||
                  (cacheConfig.maxCacheCount &&
                    cacheConfig.maxCacheCount < cachePairs.length + 1)
                ) {
                  storageStrategy.removeAtIndex(0, cacheKey);
                }

Would be nice if cacheBuster had an option to provide the parameters - that way you could remove only some values :)

Hm, that's a nice idea, let me think about that :)

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.