cacheme
Unobtrusively handles http cache based route and params
Last updated 6 years ago by coorpacademy .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cacheme 
SYNC missed versions from official npm registry.

Nodejs Http Cache Helper

Coverage Status Build Status

A simple but robust Http cache helper

Installation

Node

npm install cacheme --save

Usage

You can simply use CacheMe as a classic middleware

{
    "main.strategy": {
        "priority": 1, // lower is more important
        "rules":  [
            {
                "method": "get, post, put, del, case insensitive",
                "path":"regex",
                "cache": {
                    override: 'public, smax-age: 40',
                    proxy: 'public',
                    unit: 'second, minute, hour, month, year',
                    duration: 60
                }

            }
        ]
    }
}

HttpCache can alos be use directly if you don't need to define strategy based on path

"cache": {
	override: 'public, smax-age: 40',
	proxy: 'public',
	unit: 'second, minute, hour, month, year',
	duration: 60,
    noRevalidate: true || false // this will erase Etag or Last-Modified hedader avoinding 304, default is false
}

Changelog

0.0.5

  • fix issue about middleware step, now revalidate header are only remove in last step on response.end

0.0.4

  • add support of removing revalidate header (Etag, Last-Modified)

0.0.3

  • fix issue with case on method

0.0.2

  • fix issue on exposing middleware

0.0.1

  • first commit

Roadmap

  • Add Expires headerpostMessage

Credits

Loïc Calvy

License

The MIT License

Current Tags

  • 0.0.5                                ...           latest (6 years ago)

5 Versions

  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |