0.0.5 • Published 7 years ago

fmem v0.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

fmem

Forgettable Memorizer for Node.js

Motivation

Memorization is a well-known optimization technique in computer science.

The concept is well described on wikipedia

Memorization library has been written to be used transparently by wrapping original functions to automate cache store and hit for a high-cost (may be computationally heavy) functions. That is great solution to optimize cost functions that are stateless returning the same result with the same input. Therefore, in case of dynamic function call that the result can be changed over time, you have to deal with the updating delay with the ttl of the cache, and the recalulation overhead from unnessary cache timeout.

This library is to deal with the both issues, advantage of the optimization and the overhead of the data update.

Let's say we have a database to store user properties and a redis cache to boost up the read performance. The application servers are deployed and horizontally-scalable. You can wrap the db read functions with redis access to optimize the performance, as I mentioned earlier you have to deal with the time-lag until the cache to be cleared and updated. But, we know when we need to clear the cache. It is only when the system update the user property information. So, we can clear the cache when we update the user property information to minimize the updated information propagation. So, it is basically same with memorization pattern but we know when we need to forget the memorized results.

Not only for the database access case, we can generalize the concept as forgettable memorization pattern. This library is to implement the concept, and make developers easier to use memorization pattern transparently and safely even with stateful functions. (This may not be returning different results for every function call because it is meaningless using memorization pattern for extremely dynamic functions.)

Just started

This project is just crated and under the phase of very basic functionality implementation. Please do not consider this library for important projects. The data structures, algorithms, and also the interfaces possibly would be changed frequently over time.

Functionalities

(working on the documentation)

This is on GitHub. Redis MapCache for fmem fmem-mapcache-redis on GitHub fmem-mapcache-redis on NPM

inspired by:

License

MIT License

Contacts

Any comments and questions are welcome.

Semin Sim seminsim@gmail.com

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago