Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xadillax/exmcached-session
:m: Session store for expressjs with memcached.
https://github.com/xadillax/exmcached-session
Last synced: 28 days ago
JSON representation
:m: Session store for expressjs with memcached.
- Host: GitHub
- URL: https://github.com/xadillax/exmcached-session
- Owner: XadillaX
- License: mit
- Created: 2015-12-28T07:53:39.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-26T22:58:57.000Z (over 5 years ago)
- Last Synced: 2024-10-05T01:52:59.204Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Exmcached Session
Ⓜ️ Session store for expressjs with memcached.
## Installation
```sh
$ npm install --save exmcached-session
```## Example
```javascript
var express = require("express");
var session = require("express-session");
var cookieParser = require("cookie-parser");
var http = require("http");
var app = express();
var MemcachedStore = require("../exmcached")(session);app.use(cookieParser());
app.use(session({
secret: "*@(!@*#)!@(*)(!*@)",
key: "boom-shakalaka",
store: new MemcachedStore({
hosts: "127.0.0.1:11211",
prefix: "test"
})
}));app.get("/", function(req, res) {
if (req.session.views) {
++req.session.views;
} else {
req.session.views = 1;
}
res.send("Viewed " + req.session.views + " times.");
});http.createServer(app).listen(9341, function() {
console.log("Listening on %d", this.address().port);
});
```## Options
+ `hosts`: Memcached servers locations, this is a string.
+ `prefix`: An optional prefix for each memcache key, in case you are sharing your memcached servers with something generating its own keys.
+ ... Rest of given option will be passed directly to the memjs constructor.For details see [memjs](http://amitlevy.com/projects/memjs/).
## Contribution
This repo is modified from [https://github.com/balor/connect-memcached](https://github.com/balor/connect-memcached). And that repo seems not maintained anymore (last version was published 2 years ago). So I created this repo.
You're welcome to make pull requests!
「雖然我覺得不怎麼可能有人會關注我」