npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fmem

v0.0.5

Published

Forgettable Memorizer Library for Node.js

Readme

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 [email protected]