Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/mdock-cache
An in-memory cache for mdock
https://github.com/binocarlos/mdock-cache
Last synced: 11 days ago
JSON representation
An in-memory cache for mdock
- Host: GitHub
- URL: https://github.com/binocarlos/mdock-cache
- Owner: binocarlos
- Created: 2014-08-26T01:06:54.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-29T12:33:53.000Z (about 10 years ago)
- Last Synced: 2024-10-12T13:55:45.119Z (about 1 month ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## mdock-cache
An in-memory cache for [mdock](https://github.com/binocarlos/mdock.git) that routes requests to /images/create onto the same server as the previous /containers/create request
## install
```
$ npm install mdock-cache
```## usage
```js
var http = require('http')
var mdock = require("mdock")
var mdockcache = require("mdock-cache")var dockers = mdock()
// the mdockcache will remember routing decisions for images
dockers.on('route', mdockcache(function(info, next){
customRoutingLogic(info, next)
}))dockers.on('map', function(info, next){
next()
})dockers.on('start', function(info, 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