Comments (2)
Hi,
Just invoking :ets.file2tab
is not sufficient. As you mention in the code comment, this creates a new ETS table, but that's not the table managed by ConCache, so your data is not yet in the cache.
After you load this table, you need to iterate the table and store each element into ConCache
using ConCache.put
. Once you're done with that, you should drop the table created via :ets.file2tab
.
One downside here is that during priming you have two copies of the data. The one is in the temp table, another in the cache. The first copy is dropped once you prime your ConCache
table, but during priming you'll use more memory than you need. Depending on the amount of the cached data, this might or might not be a problem. If it is, consider using some "iterable" persistence format, which allows you to load each entry one by one, instead of loading everything at once.
Let me know if you have further questions.
from con_cache.
That does seem like a few extra hoops to jump through. Since the dataset being cached can get quite large it doesn't feel like this is a great option as there's a cost. PersistentETS may be better for what we need but it's good to know how to get persistent caching working.
from con_cache.
Related Issues (20)
- get_or_store for bag types HOT 6
- Crashed cache won't work anymore after restart HOT 3
- get_or_store with a fallback feature to check for value elsewhere and load into cache HOT 13
- TTL expiry query HOT 6
- Putting into wrong cache name hangs HOT 1
- Question: does this work across nodes? HOT 4
- warning: the dependency :con_cache requires Elixir "~> 1.4.0" but you are running on v1.5.0 HOT 3
- TTL Check should have a default value or produce a warning HOT 4
- Items don't expire any more HOT 2
- Compatibility with module-based supervisors HOT 4
- Misleading readme file HOT 1
- concahe's weird behaviour on ConCache.get HOT 1
- Broadcast event on expire HOT 2
- Dirty Read HOT 2
- How do I use this with libcluster?
- Allow LockSupervisor n_partitions to be configurable. HOT 1
- (EXIT) time out when calling a get_or_store
- Caches not expiring HOT 3
- Hit/miss ratio tracking HOT 10
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 con_cache.