Skip to content

gibme-npm/cache

Repository files navigation

A Simple Caching Wrapper

Features

  • Provides a common interface between backend systems
  • Backend systems supported:

Documentation

https://gibme-npm.github.io/cache

Sample Code

Memory

import Memory from '@gibme/cache/memory';

(async () => {
    const client = new Memory();
    
    await client.set('somekey', { some: 'value' });
    
    const value = await client.get('somekey');
    
    if (value) {
        console.log(value);
    }
    
    await client.disconnect();
})();

Redis

import Redis from '@gibme/cache/redis';

(async () => {
    const client = new Redis({
        host: 'localhost',
        username: 'someuser',
        password: 'somepassword'
    });
    
    await client.set('somekey', { some: 'value' });
    
    const value = await client.get('somekey');
    
    if (value) {
        console.log(value);
    }
    
    await client.disconnect();
})();