https://github.com/endel/memshared
Redis-like in-memory database for NodeJS clustered applications
https://github.com/endel/memshared
cluster database in-memory nodejs
Last synced: 9 months ago
JSON representation
Redis-like in-memory database for NodeJS clustered applications
- Host: GitHub
- URL: https://github.com/endel/memshared
- Owner: endel
- License: mit
- Created: 2017-05-01T12:32:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-19T02:30:49.000Z (almost 3 years ago)
- Last Synced: 2025-03-26T14:21:24.554Z (10 months ago)
- Topics: cluster, database, in-memory, nodejs
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/memshared
- Size: 75.2 KB
- Stars: 30
- Watchers: 3
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# memshared
[](http://travis-ci.org/endel/memshared)
Redis-like in-memory database for NodeJS clustered applications.
## Why?
Adding Redis as a dependency will inevitably increase the complexity to your
application and your environment. Use this library if you want to keep a simple
architecture while at the same time allow you to migrate to a real in-memory
database when you feel the need for it.
## Usage
```typescript
import * as cluster from "cluster";
import * as memshared from "memshared";
if (cluster.isMaster) {
memshared.setup({
// setup your initial data
});
cluster.fork();
} else {
memshared.set('foo', 'bar');
memshared.get('foo', function (err, result) {
console.log(result);
});
memshared.del('key');
memshared.sadd('set', 1);
}
```
## Usage with PM2
You'll need a script to start PM2. See [this example](pm2/pm2.js).
```
node pm2/pm2.js
```
## Missing commands
There are a lot of commands missing. Feel free to pick one of them and send a
pull-request: https://github.com/endel/memshared/issues/7
## License
MIT