Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memcache-client-memoizer

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memcache-client-memoizer - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

4

dist/index.d.ts
export declare type InputFunction = (...args: any[]) => Promise<any>;
export interface ICacheClient {
get(key: string): Promise<any>;
set(key: string, value?: any, options?: any): any;
get(key: any): Promise<any>;
set(key: any, value?: any, options?: any): any;
}

@@ -6,0 +6,0 @@ export declare type ICacheClientProvider = () => ICacheClient;

export type InputFunction = (...args: any[]) => Promise<any>;
export interface ICacheClient {
get(key: string): Promise<any>;
get(key: any): Promise<any>;
set(key: string, value?: any, options?: any): any;
set(key: any, value?: any, options?: any): any;
}

@@ -8,0 +8,0 @@

{
"name": "memcache-client-memoizer",
"version": "2.0.0",
"version": "2.1.0",
"description": "Memoizes promise-returning functions via memcache-client",

@@ -5,0 +5,0 @@ "main": "dist/index",

@@ -23,3 +23,3 @@ ## memcache-client-memoizer

* `options`: `object`. Required. An object with the following keys:
* `client`: `{ get: (string) => Promise, set: (string, any) }`. A cache client instance, must have a `get` and `set`
* `client`: `{ get: (anything) => Promise, set: (anything, value, options) }`. A cache client instance, must have a `get` and `set`
method. The `get` method must return a promise.

@@ -29,6 +29,6 @@ * `clientProviderFn`: `() => client` A function which returns a `client` (defined above);

* `fn`: `Function`. Required. The function to memoize, must return a Promise.
* `keyFn`: `(args to fn) => 'key-string'`. Required. A function which returns a string cache-key for memcached. This
* `keyFn`: `(args to fn) => anything`. Required. A function which returns a cache-key (can be anything) for caching. This
function is called with the same arguments as `fn`, allowing you to create a dynamic cache-key, for example:
```javascript
const exampleKeyFn = ({ name, color }) => `${name}:${color}`
const exampleKeyFn = ({ name, color }) => `${name}:${color}` // can be anything
```

@@ -53,3 +53,3 @@ * `setOptions`: `object`. Optional. For `memcached-client` this can be

fn: fnToMemoize,
keyFn: ({ name, color }) => `${name}:${color}`,
keyFn: ({ name, color }) => `${name}:${color}`, // this can return anything
cacheResultTransformFn: ({value}) => value

@@ -56,0 +56,0 @@ })

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