Skip to main content

Redis

This integration provides a full integration with Redis.

Requirements

To use it, you must install it into the API Harmonization server by running:

npm install @o2s/integrations.redis --workspace=@o2s/api

This integration relies upon the following environmental variables:

nametypedescription
CACHE_ENABLEDbooleandetermines whether cache should be enabled or not
CACHE_TTLnumbertime (in seconds) until cached key expires
CACHE_REDIS_HOSTstringdomain under which Redis instance is available
CACHE_REDIS_PORTnumberport of the Redis instance
CACHE_REDIS_PASSstringRedis password

Supported modules

This integration handles following base module from the framework:

  • cache

Redis client

This integration relies on the official Redis client for:

  • creating a client, where it is initialized using the env variables:
    createClient({
    url: `redis://${configService.get('CACHE_REDIS_HOST')}:${configService.get('CACHE_REDIS_PORT')}`,
    password: configService.get('CACHE_REDIS_PASS'),
    });
  • error handling and connection retries,
  • getting/setting/deleting keys.