Code Monkey home page Code Monkey logo

cache-candidate's People

Contributors

abettini avatar cadienvan avatar eomm avatar michael-diprisco avatar pellegrinodurante avatar rollsappletree avatar zsimo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cache-candidate's Issues

Allow TTL refresh on cache adapter

As of right now, our keepAlive flag allows our internal timers to clear and restart on every request, yet I think we should allow our devs to define a "refreshTTL" method of some sort to be called in order to warn the cache adapter to refresh.

Think Redis: We can't leverage its internal EX because of our usage of timer bombs.

New hook: attach/mount

Why don't we allow our plugins to preload/attach something on function wrap? I mean without it being called. Surely the payload will be smaller.

Read-only functions

We should freeze our internal functions but the getDataCacheKey and the getExceedingAmount to prevent overriding from plugins.

Implementing LRU

The title explains itself I guess eheh
We could have a 30 secs timeframe filled with THOUSANDS of different parametrized function calls results. We should implement some sort of LRU with a size buffer and remove the oldest items.

Allow hooks to have knowledge of internal functions + prevent infinite loop

As of the general discussion of 2023-01-27, we decided the following:

  • Force all hooks executions inside internal functions
  • Expose all those functions to our plugins

As such, as an example, our dependency keys plugin would directly call deleteDataCacheRecord instead of calling the cache adapter directly.

Check timeouts

Just a reminder: Check all timeouts are reffed or unreffed correctly.

Separating the decorator

I was thinking, as this will go Open Source at one point or another, to just move the decorator away from the main package and provide it as a different package.

Doing so will allow us to remove the experimental decorators parameter from tsconfig and proceed with a simple HOF.

The decorator will just have this package as a dependency and just wrap the target descriptor with a cacheCandidate HOF.

Math.random speed issues

We should check our uuid generation speed. I did some work on hyperid and we could consider switching for it as it is a small dependency providing the fastest uid generation known in node.

Check the contract

Are we sure the interface we are exposing for the candidate is of the same type as the initial function?

Generic cache adapter

We should bring in a generic cache adapter for situations in which memory and redis aren't the choice. Or maybe when you use a different redis lib (ioredis).

Add Github Actions

Starting from simple ones as a test launcher, I'd like to bring in some actions.

Try to use test to feed clinic.js

To have better data from clinic, and to be sure that clinic go throught all our codebase we shoud try to use the test suite js to feed clinic.

cache disabler

A plugin providing a Boolean or similar to disable cache. As an example of implementation , it could call the cache delete and/or empty the timeframe cache at every call

Benchmark worst case

We should have a look at how much the library impacts the worst case scenario: where nothing is cached.

How much average time does the candidate need to execute?

Explicitly exporting from index

I was thinking we could explicitly export variables in our index file so that we don't risk exposing something unwanted in the future.

What I'm thinking is, as an example, moving from export * from './lib' to export {cacheCandidate, CacheCandidate} from './lib'.

Anything against it?

invalidateFunction

What about a function similar to the candidate used to drop an entry from the data cache?

candidateFunction: async

I know we made the decision of going sync to prevent performance burdens, yet our users could need it for one reason or another.
We should discuss it!

Better Types

Allow a Generic to be passed to the cache candidate so that the resulting function can be typed correctly.

Plugin Idea - UI

Our new plugin internals interface would allow us to build an awesome UI, we could even have a timeline tracking everything happening in our app at any given time!

Key modifier

Me and @rollsappletree agree we could create a plugin allowing to change the key allowing a function to return a new key string.
It could be usable in logging contexts where a crypted key as we provide isn't suitable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.