@aicore/libcache
Advanced tools
Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "@aicore/libcache", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Cache library for core.ai services", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,5 +14,34 @@ # libcache | ||
MEMCACHE_PASSWORD - used if MEMCACHIER_PASSWORD is not present | ||
```js | ||
// sample code on how to use library | ||
import {putToCache, getValueFromCache, deleteKeyFromCache, closeCache} from '@aicore/libcache'; | ||
const key = 'hello'; | ||
const value = { | ||
'name' : 'ram', | ||
'age' : 100 | ||
}; | ||
const ttl = 100; // in seconds | ||
try { | ||
await putToCache(key, value, ttl); | ||
}catch (e){ | ||
console.error(e); | ||
} | ||
try { | ||
await getValueFromCache(key); | ||
} catch (e){ | ||
console.error(e); | ||
} | ||
try { | ||
await deleteKeyFromCache(key); | ||
} catch (e){ | ||
console.log(e); | ||
} | ||
// close cache client | ||
closeCache(); | ||
``` | ||
## Code Guardian | ||
@@ -19,0 +48,0 @@ |
52147
226