0.3.0 • Published 7 years ago

bi-service-sdk-cache v0.3.0

Weekly downloads
3
License
-
Repository
-
Last release
7 years ago

Provides request cache middleware for SDKs which implement bi-service-sdk interface.

Integration

const SDK = require('sdk-which-implements-bi-service-sdk-interface');
const BIServiceSDKCache = require('bi-service-sdk-cache');
const CacheStoreInterface = require('bi-cache-store-interface');

var sdk = new SDK({baseURL: '127.0.0.1'});

sdk.use(BIServiceSDKCache({
    store: memcached, //memcached must implement CacheStoreInterface (and be instanceof CacheStoreInterface)
    ttl: 10 * 60 // in seconds
}));

sdk.<requestMethod>(); //uses cache store
sdk.<requestMethod>({cache: false}); //does NOT use cache store