Comments (1)
Hi,
If you use default serializer, it means you are using serialization of your
bitmaps into Json format, which I doubt you really want. With bitmaps you
should write your own custom serializer (at least for disk, in RAM you
should keep references) with examples like this
http://stackoverflow.com/questions/13562429/how-many-ways-to-convert-bitmap-to-string-and-vice-versa
2015-11-24 10:43 GMT+01:00 Andreas Gohr [email protected]:
I use the following to to cache Bitmaps:
DualCacheLogUtils.enableLog();DualCacheContextUtils.setContext(RadioApplication.getAppContext());
cache = new DualCacheBuilder(CACHE_NAME, CACHE_VERSION, Bitmap.class)
.useReferenceInRam(CACHE_RAM, new SizeOfBitmap())
.useDefaultSerializerInDisk(CACHE_DISK, true);Storing seems to work fine, but when trying to retrieve an entry from
cache, I get the following:I/dualcache: Entry for e5429ada18f6df2de9c9870c379b7eb4 is on disk.
E/dualcache: error :
com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class android.graphics.Bitmap]: can not instantiate from JSON object (need to add/enable type information?)
at [Source: {"mStackTrace":null,"mBuffer":null,"mRestorePolicyInfo":null,"mFinalizer":["android.graphics.Bitmap$BitmapFinalizer",{"mStackTrace":null,"mIsPreloaded":false,"mNativeBitmap":2140966016,"mPixelsIsAllocated":true,"mRecycled":false,"mBitmapSize":878000}],"mNinePatchChunk":null,"mLayoutBounds":null,"mIsMutable":false,"mIsPreloading":false,"mIsPremultiplied":true,"mIsRestorable":false,"mInUse":false,"mNativeBitmap":2140966016,"mNativeBitmapFreed":false,"mHeight":439,"mPixelsIsAllocated":true,"mRecycled":false,"mDensity":480,"mBitmapSize":878000,"mWidth":500}; line: 1, column: 2]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1063)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:264)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:124)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2146)
at com.vincentbrison.openlibraries.android.dualcache.lib.DualCache.get(DualCache.java:410)—
Reply to this email directly or view it on GitHub
#21.
Android enthusiast : vincentbrison.com
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.