express-redis-render-cache

Cache the result of res.render, supports querystring whitelisting and validation.

Usage no npm install needed!

<script type="module">
  import expressRedisRenderCache from 'https://cdn.skypack.dev/express-redis-render-cache';
</script>

README

The tests in this module flush Redis DB 15 to change the test DB use REDIS_DB=num to override


Usage

Requires Node V6

Cache Key generation

const supportedQuerystrings = {
    key: true, // Accepts all values
    complex: () => {} // Return a boolean
};

Basic

    const cache = expressRedisCache(supportedQuerystrings);

    app.use(cache);

Named

    const cache = expressRedisCache('blogPosts', supportedQuerystrings);

    app.use('/blog', cache); // OR
    app.use(cache);