Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/flocker-cache
An in-memory cache for flocker routing
https://github.com/binocarlos/flocker-cache
Last synced: 11 days ago
JSON representation
An in-memory cache for flocker routing
- Host: GitHub
- URL: https://github.com/binocarlos/flocker-cache
- Owner: binocarlos
- Created: 2014-08-13T15:42:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-13T15:42:21.000Z (over 10 years ago)
- Last Synced: 2024-08-09T01:39:58.001Z (3 months ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## flocker-cache
An in-memory cache for [flocker](https://github.com/binocarlos/flocker.git) that routes requests to /images/create onto the same server as the previous /containers/create request
## install
```
$ npm install flocker-cache
```## usage
```js
var http = require('http')
var flocker = require("flocker")
var flockercache = require("flocker-cache")var dockers = flocker()
// the flockercache will remember routing decisions for images
dockers.on('route', flockercache(function(info, done){
customRoutingLogic(info, done)
}))dockers.on('map', function(name, container, image, next){
next()
})dockers.on('list', function(next){
next(null, serverList)
})var server = http.createServer(function(req, res){
dockers.handle(req, res)
})server.listen(80)
```the cache will keep state between subsequent /containers/create and /images/create requests and route them to the correct address
## license
MIT