Comments (3)
Hi,
You could use this configuration, as its done in one of the test of the lib.
This way bitmaps will be cached in RAM through their references, and store on disk through a custom serializer that you provide :
- You need to compute the size of the bitmap in RAM, to allow the cache to apply LRU policy on the RAM layer. You can use any policy you want. For example you can say that one bitmap has the value of 1 and your RAM cache has the size of 10, which allow you to store 10 bitmaps before the LRU policy start evicting bitmaps.
- To store bitmaps on disk you will need to provide a way to serialize / deserialize your bitmap through the interface https://github.com/vincentbrison/android-easy-cache/blob/master/lib/src/main/java/com/vincentbrison/openlibraries/android/dualcache/lib/Serializer.java. You can for example convert your bitmap to Base64 http://stackoverflow.com/questions/13562429/how-many-ways-to-convert-bitmap-to-string-and-vice-versa.
Keep in mind that when you put
a bitmap in the cache, it will be put in the RAM and the disk layer. When you get
the bitmap, the cache will try to load the bitmap from RAM, and if it is not present in RAM, it will try to load it from disk (and put again the bitmap in RAM btw).
BR
from dualcache.
BTW the cache fully support multi threading. So you can do multiple get
from different threads, like Asynctask
, without any problem (save and load bitmap from disk layer may be time consuming).
from dualcache.
Hi,
I close this issue, since you did not provide feedback on this. You can still i(f you feel the need) reopen this do get more information.
from dualcache.
Related Issues (20)
- NoSuchMethodException on invalidateRAM HOT 1
- examples or more info HOT 3
- Any putSync method/callback? HOT 6
- Any feature or api to remove expired cache? HOT 1
- How to use this dualcahe library?? HOT 2
- license & Proguard options HOT 2
- Add Progard configuration HOT 3
- Got error when i am trying to create jar file HOT 3
- cannot resolve symbol ObjectMapper error HOT 1
- Flush ram cache to disk HOT 1
- How to deal with collection with generic HOT 1
- Remove clazz parameters from builder
- It's possible to set a live time to the cache entries?¿ HOT 1
- Multiple DualCaches with same id HOT 1
- CacheSerializer with direct access to DiskLruCache stream
- What about closing? HOT 5
- Why the dualcache have not cache time? HOT 1
- Is it possible to serialize to byte array instead of String? HOT 1
- Param usePrivateFiles in Builder.useSerializerInDisk() is missleading
- IllegalStateException on reading from Cache HOT 1
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 dualcache.