Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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