Getting issue " object cannot exceed 10240 bytes" while cache data using backendless
There’s a hard limit for the size of each object in cache, and it’s exactly 10240 bytes. What kind of object are you trying to save? Probably you don’t need to store an object that big in cache.
Actually i want to maintain cache for store geopoints data
Can you provide an example object you’d like to store in JSON format here?
{“objectId”:“0007E55F-CA4B-E39C-FFC3-86BFD6008707”,“categories”:[“EVENTS”],“metadata”:{“city”:“test city”,“event”:[{“place_name”:“test place”,“created”:1544696232420,“place_street_nr”:“test strret”,“event_subregion_id”:“ghfghfg”,“event_title”:“dfgdfgdf”,“ownerId”:null,“Horbehinderung”:false,“event_eventtype”:“test type”,“GeistigeBehinderung”:false,“place_zip”:12167,“datum2”:“Do, 17.10. 16-17 Uhr”,“Gehorlos”:false,“event_id”:119960,“Mobilitatsbehinderung”:true,“place_equip”:“sdfsdfsd”,“Sehbehinderung”:false,“updated”:null,“objectId”:“96F35BA9-EE8A-25AD-FFC3-1ACE3573B400”,"___class":“events”}]},“latitude”:52.449453461192,“longitude”:13.338511457672,"___class":“GeoPoint”}
this is single one, i have many records in object
The one you provided is way less than 10240 bytes (it is even less than 1000 bytes). Objects like this are totally fine to cache. It looks like you have some other object that is 10+ times bigger than this, and I guess you should split it before storing into cache.
I have 20000 geopoints like above single record
So you should store them into separate cache objects, not merge into one. How do you store them in your code?
Actually now i am getting only 100 because of cloud version, event though it crosses 10240 bytes. I am trying to save the object into cache by converting into byte array and saving into cache but i am not able to get original object from byte array while getting from cache
Well, you can purchase a function pack called “100 Cache Objects” to increase the number. This is just how it is now: the limit for a number of cache objects in Cloud 99 plan is 100, and the limit for a single object size is 10240 bytes. If you have any issues with this, I guess you could discuss it by writing to sales@backendless.com.
I have doubt regarding getting actual object from byte array while getting cache, i am not able to get that?
It depends on how you serialize your object into byte array and how you deserialize it. Anyway, this is out of our support scope as it’s not directly related to Backendless. I’d say you don’t need to do that at all, since the object is serialized to bytes on the backend anyway before storing into cache, so you’re not likely to save the size by doing it manually. From your perspective it should look similar to this example in the doc, i.e. you just work with the class you’re trying to store or retrieve: https://backendless.com/docs/android/ut_putting_data_into_cache_android.html