Comments (4)
More thoughts on LRU:
- We can provide a
touch
function which is basicallyrefresh
without updating the TTL (so it just updates the write time). - An LRU policy can simply invoke the LRW policy, but add in a hook which touches keys when they're read.
- If you don't want all keys to be read, maybe we add a
touch: false
option to all read operations? - Alternatively, you can just use an LRW policy and touch keys when you wish.
This would mean that we only have one heavy lifting policy (LRW), but support both the LRW and LRU use cases. I think this is elegant, and should suffice for now - things like LFU would be extremely difficult to implement without introducing higher memory usage.
from cachex.
Currently I have an implementation of an LRW (least-recently written) hook which works and caps based on a given reclaiming boundary. This is implemented entirely without need for separate storage and is actually quite cheap, and seems to be pretty fast (as much as you can expect, anyway).
Not entirely sure about how to create an LRU which doesn't need some sort of key tracking, which would naturally make it way more expensive (because there would be a write on every read). It may just be that we go with just LRW for 2.x and direct people to touch
their keys as needed.
from cachex.
LRW is merged in. LRU is going to take a little time because there are a few other issues to cleanup first before I take a shot at that (because I'd just have to rewrite it).
@emerleite feel free to play around with Master to try out the limits.
from cachex.
@zackehh thanks. I'll start using this next week ;)
from cachex.
Related Issues (20)
- [question][guidance] bulk increment with ttl HOT 3
- Using Cachex with Phoenix and iex HOT 4
- [Elixir 1.15] ** (MatchError) no match of right hand side value: {1, {:error, :no_cache}} HOT 3
- Cachex.fetch hangs and breaks my app HOT 13
- Cachex warmer breaks the application with "no match of right hand side value: {:error, :no_cache}" error HOT 11
- Possible bug in :cachex_notify event handling? HOT 1
- Using `ordered_set` type tables to back cache HOT 1
- qlc error - max limit cache eviction fails for no cwd write permissions HOT 3
- Consider upgrading provisions to support Warmers as well as Hooks HOT 1
- Warmer blocking should be enabled on cache, rather than individual warmers HOT 2
- Warmers should have names defined, rather than simply the module name
- The :transactional option should be renamed to :transactions
- Cachex.warm/2 should be able to flip between blocking vs. non-blocking
- Remove set and set_many from the public API
- Migrate from using jump hashing to libring
- Create an abstraction over cluster state and routing
- Improve documentation on distributed caches
- Fetch can allow multiple executions of `fallback` function HOT 5
- Drop support for Elixir < 1.7
- dialyxir error in cachex/hook.ex:171:pattern_match_cov HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cachex.