New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@luvio/service-cache

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luvio/service-cache - npm Package Compare versions

Comparing version 5.26.0 to 5.27.0

5

dist/types/v1/cache.d.ts

@@ -0,1 +1,2 @@

import { type DeepReadonly } from '@luvio/utils';
import { type Key, type KeySet } from './keys';

@@ -41,3 +42,5 @@ /**

export type Cache = {
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key, options?: {
copy: boolean;
}): DeepReadonly<CacheEntry<T>> | CacheEntry<T> | undefined;
set<T>(key: Key, value: CacheEntry<T>): void;

@@ -44,0 +47,0 @@ delete(key: Key): void;

12

dist/types/v1/default.d.ts

@@ -0,1 +1,2 @@

import { type DeepReadonly } from '@luvio/utils';
import { type Key, type KeySet } from './keys';

@@ -7,8 +8,15 @@ import type { CacheEntry, Cache, FilteredCache, RecordableCache, FilterPredicate } from './cache';

/**
* Returns the cache entry at the specified key; undefined if no
* Returns a cache entry at the specified key; undefined if no
* such entry exists.
*
* @param key store key
* @param [options] options for get (e.g. copy for deep copy)
*/
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key): DeepReadonly<CacheEntry<T>> | undefined;
get<T>(key: Key, options: {
copy: true;
}): CacheEntry<T> | undefined;
get<T>(key: Key, options: {
copy: false;
}): DeepReadonly<CacheEntry<T>> | undefined;
/**

@@ -15,0 +23,0 @@ * Adds the specified key/value to the cache.

@@ -0,1 +1,2 @@

import { type DeepReadonly } from '@luvio/utils';
import { type Key, type KeySet, KeySetImpl } from './keys';

@@ -13,3 +14,9 @@ import type { CacheEntry, Cache, RecordableCache, FilteredCache, FilterPredicate } from './cache';

delete(key: Key): void;
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key): DeepReadonly<CacheEntry<T>> | undefined;
get<T>(key: Key, options: {
copy: true;
}): CacheEntry<T> | undefined;
get<T>(key: Key, options: {
copy: false;
}): DeepReadonly<CacheEntry<T>> | undefined;
set<T>(key: Key, value: CacheEntry<T>): void;

@@ -30,3 +37,9 @@ length(): number;

delete(key: Key): void;
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key): DeepReadonly<CacheEntry<T>> | undefined;
get<T>(key: Key, options: {
copy: true;
}): CacheEntry<T> | undefined;
get<T>(key: Key, options: {
copy: false;
}): DeepReadonly<CacheEntry<T>> | undefined;
set<T>(key: Key, value: CacheEntry<T>): void;

@@ -33,0 +46,0 @@ length(): number;

@@ -7,2 +7,4 @@ /**

import { deepCopy } from '@luvio/utils';
/**

@@ -65,2 +67,3 @@ * A collection of keys, in no particular order.

/* eslint-disable no-dupe-class-members */
/**

@@ -80,3 +83,3 @@ A utility class for recording actions made on a cache.

}
get(key) {
get(key, options) {
this.keysRead.add(key);

@@ -87,2 +90,5 @@ const value = this.baseCache.get(key);

}
if (options === null || options === void 0 ? void 0 : options.copy) {
return deepCopy(value);
}
return value;

@@ -121,6 +127,9 @@ }

}
get(key) {
get(key, options) {
const result = this.baseCache.get(key);
// if we're chaining filtered caches together, then it's possible the result will be undefined here
if (result && this.predicate(key, result)) {
if (options === null || options === void 0 ? void 0 : options.copy) {
return deepCopy(result);
}
return result;

@@ -162,2 +171,3 @@ }

/* eslint-disable no-dupe-class-members */
class DefaultCache {

@@ -167,9 +177,6 @@ constructor() {

}
/**
* Returns the cache entry at the specified key; undefined if no
* such entry exists.
*
* @param key store key
*/
get(key) {
get(key, options) {
if (options === null || options === void 0 ? void 0 : options.copy) {
return deepCopy(this.data[key]);
}
return this.data[key];

@@ -176,0 +183,0 @@ }

@@ -0,1 +1,2 @@

import { type DeepReadonly } from '@luvio/utils';
import { type Key, type KeySet } from './keys';

@@ -41,3 +42,5 @@ /**

export type Cache = {
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key, options?: {
copy: boolean;
}): DeepReadonly<CacheEntry<T>> | CacheEntry<T> | undefined;
set<T>(key: Key, value: CacheEntry<T>): void;

@@ -44,0 +47,0 @@ delete(key: Key): void;

@@ -0,1 +1,2 @@

import { type DeepReadonly } from '@luvio/utils';
import { type Key, type KeySet } from './keys';

@@ -7,8 +8,15 @@ import type { CacheEntry, Cache, FilteredCache, RecordableCache, FilterPredicate } from './cache';

/**
* Returns the cache entry at the specified key; undefined if no
* Returns a cache entry at the specified key; undefined if no
* such entry exists.
*
* @param key store key
* @param [options] options for get (e.g. copy for deep copy)
*/
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key): DeepReadonly<CacheEntry<T>> | undefined;
get<T>(key: Key, options: {
copy: true;
}): CacheEntry<T> | undefined;
get<T>(key: Key, options: {
copy: false;
}): DeepReadonly<CacheEntry<T>> | undefined;
/**

@@ -15,0 +23,0 @@ * Adds the specified key/value to the cache.

@@ -0,1 +1,2 @@

import { type DeepReadonly } from '@luvio/utils';
import { type Key, type KeySet, KeySetImpl } from './keys';

@@ -13,3 +14,9 @@ import type { CacheEntry, Cache, RecordableCache, FilteredCache, FilterPredicate } from './cache';

delete(key: Key): void;
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key): DeepReadonly<CacheEntry<T>> | undefined;
get<T>(key: Key, options: {
copy: true;
}): CacheEntry<T> | undefined;
get<T>(key: Key, options: {
copy: false;
}): DeepReadonly<CacheEntry<T>> | undefined;
set<T>(key: Key, value: CacheEntry<T>): void;

@@ -30,3 +37,9 @@ length(): number;

delete(key: Key): void;
get<T>(key: Key): CacheEntry<T> | undefined;
get<T>(key: Key): DeepReadonly<CacheEntry<T>> | undefined;
get<T>(key: Key, options: {
copy: true;
}): CacheEntry<T> | undefined;
get<T>(key: Key, options: {
copy: false;
}): DeepReadonly<CacheEntry<T>> | undefined;
set<T>(key: Key, value: CacheEntry<T>): void;

@@ -33,0 +46,0 @@ length(): number;

{
"name": "@luvio/service-cache",
"version": "5.26.0",
"version": "5.27.0",
"private": false,

@@ -33,3 +33,3 @@ "description": "OneStore Cache Service definition",

"dependencies": {
"@luvio/utils": "5.26.0"
"@luvio/utils": "5.27.0"
},

@@ -36,0 +36,0 @@ "volta": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc