paquitosoft / memored Goto Github PK
View Code? Open in Web Editor NEWIn-memory shared cache for nodejs application using cluster module
License: MIT License
In-memory shared cache for nodejs application using cluster module
License: MIT License
Hi , I liked this project a lot. couple of questions:
Thanks,
Guy
Hello everyon. Could you tell me, how memored work with high load servers?
The load of my server equal 1 billion request per day. How I understand first I have to add require('memoried') to master script, then I have to add it to workers lib.
I think Server Master could drop under pressure of traffic.
Hey there,
I was searching for a way to share data between cluster workers and found your project.
I don't want to increase the complexity of my architecture by adding Redis as a dependency, but I need support to more advanced data structures though, like lists maps, etc.
Do you plan to support those in your library? Cheers.
Is there a way, to add several domains of cache?
let memored = require('memored')
let cache1 = new memored();
cache1.setup({ domain: "ipV6", purgeInterval: 3 * 60 * 60 * 1000});
let cache2 = new memored();
cache2.setup({ domain: "ipV4", purgeInterval: 24 * 60 * 60 * 1000}});
I am writing this comment to commend the writer of this module.
It is really good for clusters management in Node.js. It scales so well to several applications.
It is very small and compact.
I have been using it for over 4 months now and I can't believe the excellent performance I am getting from it, especially with well structured IIFE codes (https://en.wikipedia.org/wiki/Immediately-invoked_function_expression).
I hope the author can write a small book on this module to let people know of its functionalities.
Memored needs a new configuration so users can set an upper limit to its size.
Maybe I can use the same idea Isaacs used in his mode-lru-cache module.
{
DefaultFlow: require('./shared/defaultFlow/defaultFlow'),
DefaultFlowChild: require('./shared/defaultFlow/defaultFlowChild'),
User: require('./auth/user'),
Task: require('./shared/Task/task'),
Process: require('./shared/Task/process'),
Workflow: require('./shared/Task/workflow'),
Message: require('./shared/Message/message'),
Mail: require('./official/mail/mail'),
Fat: require('./technical/panel/fat'),
}
how can i store socket io object in memored?
i cant stringify it...
Is it possible to store keys in the master and have child processes access the data? I have a long running process I only want run as one instance, and in a multi-cpu server I would have that process running multiple times unnecessarily consuming resources.
Is there any reason the master cant have access to the cache data (or even the cache itself)? It looks like the cache will return keys and can be cleared via reset(). I was looking to show the cache contents (from an express server running in the master) just for status/debugging, but the best i can do is show the keys. Thanks!
I created a Typescript-Definition file .. so maybe you can add it in your lib (https://stackoverflow.com/questions/37210059/how-to-add-a-typescript-definition-file-to-a-npm-package).
declare module "memored" {
// https://github.com/PaquitoSoft/memored#setupoptions
export interface IMemoredLogger {
log: (message: string) => any
warn: (message: string) => any
}
function setup<T extends IMemoredLogger>(options?: { purgeInterval?: number, logger?: T }): void
// https://github.com/PaquitoSoft/memored#storekey-value-ttl-callback
function store(key: string, value: any, ttl: number, cb?: (err: Error, expirationTime: number) => any): void
function store(key: string, value: any, cb?: (err: Error | null, expirationTime: number) => any): void
// https://github.com/PaquitoSoft/memored#multistoremap-ttl-callback
interface IMultiKeyValue {
[index: string]: any
}
function multiStore(IMultiKeyValue: IMultiKeyValue, ttl: number, cb?: (err: Error
| null, expirationTime: number) => any): void
function multiStore(IMultiKeyValue: IMultiKeyValue, cb?: (err: Error | null, expirationTime: number) => any): void
// https://github.com/PaquitoSoft/memored#readkey-callback
function read(key: string, cb: (err: Error | null, value: any) => any): void
// https://github.com/PaquitoSoft/memored#multireadkeys-callback
function multiRead(keys: Array<string>, cb: (err: Error | null, values: IMultiKeyValue) => any): void
// https://github.com/PaquitoSoft/memored#removekey-callback
function remove(key: string, cb?: () => any): void
// https://github.com/PaquitoSoft/memored#multiremovekeys-callback
function multiRemove(keys: Array<string>, cb?: () => any): void
// https://github.com/PaquitoSoft/memored#cleancallback
function clean(cb?: () => any): void
// https://github.com/PaquitoSoft/memored#sizecallback
function size(cb: (err: Error | null, size: number) => any): void
// https://github.com/PaquitoSoft/memored#keyscallback
function keys(cb: (err: Error | null, keys: Array<string>) => any): void
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.