Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

route-cache

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

route-cache - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

8

index.js

@@ -70,2 +70,10 @@ var Eidetic = require('eidetic');

module.exports.removeCache = function(url) {
if (redirects[url])
delete redirects[url];
cacheStore.del(url);
};
module.exports.cacheStore = cacheStore;

2

package.json
{
"name": "route-cache",
"version": "0.1.2",
"version": "0.2.0",
"description": "express middleware for caching your routes",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,6 +0,7 @@

[![Build Status](https://travis-ci.org/bradoyler/route-cache.svg?branch=master)](https://travis-ci.org/bradoyler/route-cache)
# Route-Cache
Simple middleware for Express route caching with a given TTL (in seconds)
[![Build Status](https://travis-ci.org/bradoyler/route-cache.svg?branch=master)](https://travis-ci.org/bradoyler/route-cache)
[![NPM Version][npm-image]][npm-url]
Make your routes do this ->![dodging](http://gifs.gifbin.com/1234778873_Muhammad_Ali_dodging_punches.gif)

@@ -38,2 +39,7 @@

## Delete a cached route
```javascript
routeCache.removeCache('/index');
```
## Future plans / todos

@@ -65,1 +71,4 @@ - client-side Cache-Control

SOFTWARE.
[npm-image]: https://img.shields.io/npm/v/route-cache.svg
[npm-url]: https://npmjs.org/package/route-cache

@@ -9,2 +9,3 @@

var testindex = 0;
var testindexRemove = 0;

@@ -15,3 +16,3 @@ describe('# RouteCache middleware test', function(){

app.get('/hello', routeCache.cacheSeconds(1), function(req, res){
testindex++;
testindex++;
res.send('Hello ' + testindex)

@@ -28,2 +29,7 @@ });

app.get('/hello-remove', routeCache.cacheSeconds(3600), function(req, res){
testindexRemove++;
res.send('Hello remove ' + testindexRemove)
});
var agent = request.agent(app);

@@ -62,6 +68,6 @@

it('GET #6 ~ delayed: Hello 2', function(done){
setTimeout(function() {
agent
.get('/hello')
.expect('Hello 2', done);
setTimeout(function() {
agent
.get('/hello')
.expect('Hello 2', done);
}, 1200);

@@ -81,3 +87,26 @@ });

})
})
});
it('GET #8: test removeCache', function(done){
agent
.get('/hello-remove')
.expect('Hello remove 1').end(function(req, res){
setTimeout(function() {
agent
.get('/hello-remove')
.expect('Hello remove 1').end(function(req, res){
routeCache.removeCache('/hello-remove');
agent
.get('/hello-remove')
.expect('Hello remove 2', done)
});
}, 1200);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc