apollo-server-caching
Advanced tools
Comparing version 3.1.0 to 3.2.0-alpha.0
@@ -1,2 +0,2 @@ | ||
import { KeyValueCache } from './KeyValueCache'; | ||
import type { KeyValueCache } from './KeyValueCache'; | ||
export declare class InMemoryLRUCache<V = string> implements KeyValueCache<V> { | ||
@@ -16,3 +16,4 @@ private store; | ||
getTotalSize(): Promise<number>; | ||
static jsonBytesSizeCalculator<T>(obj: T): number; | ||
} | ||
//# sourceMappingURL=InMemoryLRUCache.d.ts.map |
@@ -38,4 +38,7 @@ "use strict"; | ||
} | ||
static jsonBytesSizeCalculator(obj) { | ||
return Buffer.byteLength(JSON.stringify(obj), 'utf8'); | ||
} | ||
} | ||
exports.InMemoryLRUCache = InMemoryLRUCache; | ||
//# sourceMappingURL=InMemoryLRUCache.js.map |
@@ -1,2 +0,2 @@ | ||
import { KeyValueCache, KeyValueCacheSetOptions } from './KeyValueCache'; | ||
import type { KeyValueCache, KeyValueCacheSetOptions } from './KeyValueCache'; | ||
export declare class PrefixingKeyValueCache<V = string> implements KeyValueCache<V> { | ||
@@ -3,0 +3,0 @@ private wrapped; |
@@ -1,3 +0,3 @@ | ||
import { KeyValueCache } from './KeyValueCache'; | ||
import type { KeyValueCache } from './KeyValueCache'; | ||
export declare function runKeyValueCacheTests(keyValueCache: KeyValueCache, tick?: (ms: number) => void): Promise<void>; | ||
//# sourceMappingURL=testsuite.d.ts.map |
{ | ||
"name": "apollo-server-caching", | ||
"version": "3.1.0", | ||
"version": "3.2.0-alpha.0", | ||
"author": "Apollo <opensource@apollographql.com>", | ||
@@ -23,3 +23,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "4dc19131aaea2416b5b2ccab295b06272f94c996" | ||
"gitHead": "119dac4fbe357661cad7163dfa643b02ab479b96" | ||
} |
import LRUCache from 'lru-cache'; | ||
import { KeyValueCache } from './KeyValueCache'; | ||
import type { KeyValueCache } from './KeyValueCache'; | ||
@@ -53,2 +53,9 @@ function defaultLengthCalculation(item: any) { | ||
} | ||
// This is a size calculator based on the number of bytes in a JSON | ||
// encoding of the stored object. It happens to be what ApolloServer | ||
// uses for its default DocumentStore and may be helpful to others as well. | ||
static jsonBytesSizeCalculator<T>(obj: T): number { | ||
return Buffer.byteLength(JSON.stringify(obj), 'utf8'); | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { KeyValueCache, KeyValueCacheSetOptions } from './KeyValueCache'; | ||
import type { KeyValueCache, KeyValueCacheSetOptions } from './KeyValueCache'; | ||
@@ -3,0 +3,0 @@ // PrefixingKeyValueCache wraps another cache and adds a prefix to all keys used |
@@ -1,2 +0,2 @@ | ||
import { KeyValueCache } from './KeyValueCache'; | ||
import type { KeyValueCache } from './KeyValueCache'; | ||
@@ -3,0 +3,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
23148
28
293
1