UNPKG

@contentacms/redis

Version:

Redis wrapper for ContentaJS, a drop in replacement for the LRU in-memory cache.

70 lines (64 loc) 2.99 kB
<!-- This file was generated by emdaer Its template can be found at .emdaer/README.emdaer.md --> <!-- emdaerHash:a57cbc49dee3d2cff11f97f9a945b52a --> <h1 id="contentajs-redis-img-align-right-src-logo-svg-alt-contenta-logo-title-contenta-logo-width-100-">ContentaJS - Redis <img align="right" src="./logo.svg" alt="Contenta logo" title="Contenta logo" width="100"></h1> <p>This project is part of the <a href="https://www.npmjs.com/package/@contentacms/contentajs">ContentaJS</a> project. You need to install it inside of a ContentaJS project.</p> <!-- toc --> <ul> <li><a href="#installation">Installation</a><ul> <li><a href="#install">Install</a></li> <li><a href="#add-the-redis-configuration">Add the Redis configuration</a></li> </ul> </li> <li><a href="#contributors">Contributors</a></li> <li><a href="#license">License</a></li> </ul> <!-- tocstop --> <p><a href="https://travis-ci.org/contentacms/redis/"><img src="https://img.shields.io/travis/contentacms/redis.svg?style=flat-square" alt="Travis"></a> <a href="https://coveralls.io/github/contentacms/redis/"><img src="https://img.shields.io/coveralls/github/contentacms/redis.svg?style=flat-square" alt="Coverage"></a> <a href="https://github.com/emdaer/emdaer"><img src="https://img.shields.io/badge/📓-documented%20with%20emdaer-F06632.svg?style=flat-square" alt="Documented with emdaer"></a></p> <h2 id="installation">Installation</h2> <p>In order to use Redis as your cache back-end in ContentaJS you will need to:</p> <h3 id="install">Install</h3> <p>Install this module in your ContentaJS forked project:</p> <pre><code> yarn add @contentajs/redis </code></pre> <h3 id="add-the-redis-configuration">Add the Redis configuration</h3> <p>Add the Redis configuration to your configuration files in ContentaJS, and make Redis your active cache back-end. Make sure to configure Redis with your actual host, port, and any <a href="http://redis.js.org/#api-rediscreateclient">additional options you need</a>. Modify your <a href="https://github.com/lorenwest/node-config/wiki/Configuration-Files">config file</a> with:</p> ```yaml # NOTE: Append the 'redis' section under 'plugins' applicationCache: activePlugin: redis # <--- ACTIVATE REDIS plugins: lru: … # You can keep existing configuration to switch back if needed. foo: … bar: … redis: # <--- APPEND THIS SECTION # Additional options for node_redis # http://redis.js.org/#api-rediscreateclient passed verbatim. host: 127.0.0.1 port: 6379 prefix: 'contentajs::' ``` <h2 id="contributors">Contributors</h2> <details> <summary><strong>Contributors</strong></summary><br> <a title="Engineer and programmer focused on online applications." href="https://github.com/e0ipso"> <img align="left" src="https://avatars0.githubusercontent.com/u/1140906?s=24"> </a> <strong>Mateu Aguiló Bosch</strong> <br><br> </details> <h2 id="license">License</h2> <p>@contentacms/redis is <a href="./LICENSE">MIT licensed</a>.</p>