We have a hazelcast problem. For the last few days, it has not been refreshing itself. We have to maunally refresh the cache from the web console.
What can I do about this?
And other problem is: How can I force hazelcast to read from db if cache does not exist?
It is not clear what you mean by Refresh. Normally, what users do is, they have TTL configured for the entries in MAP. And you can also implement a MapStore that will read from DB, when entry is not available in cache. When your applications read the entry and if it doesn't exist in cache, Hazelcast will call the mapstore to read from DB. And after TTL elapsed, the entry will be removed from the cache. Next time you read it, it will be refreshed.
Related
My app uses CoreData+Cloudkit with a public database.
By default, iCloud sync with a public database is only done at launch and then every half hour.
Since my app requires faster sync, all users are logged in to iCloud, and subscribed to iCloud changes. Thus, an iCloud modification of one user sends a notification to all other users. This works.
The problem:
The notification should now trigger an update of the local persistent store, i.e. an iCloud insert or update should download the respective iCloud record, and insert it or update it in the persistent store (deletes don’t happen).
Possible solutions:
I could download the record from iCloud manually and then insert or update it in the managed context. However, an insert will then be treated as a new record, and uploaded later as a duplicate to iCloud. There will be a duplicate for every user who received the notification. While such dupes could be handled (there are only a few users), this is not so elegant.
Much better is simply to trigger a re-mirroring, as it is anyway done during launch and every half hour. But I did not find any reasonable way to do this. I found one suggestion to toggle iCloud sync off and on (which should trigger a sync), but this gives me a client error (re-registration of a mirroring agent). I found another suggestion to swap the persistent stores (one with iCloud mirroring and one without) but this seems to me a terrible hack for my problem.
My question:
What is a reasonable way to update the local store with the iCloud changes?
At the moment, the ck public db is only replicated at startup or after about 20 min
We are trying to implement cache aside pattern on azure. While reading data, we first check if data exist on cache, if it does, we serve it from cache. Otherwise we fetch it from database, populate cache and return it.
If cache is not accessible (due to some transient or non-transient issues), we ignore it.
But in case of update, we first update it in database and then delete the cache key. What should we do in case if cache is not accessible? To handle transient error we can implement retry strategy. If cache is not accessible even after retry, we should rollback our database transaction. Otherwise if cache comes back later, it would not be in sync with db. But while retrying, if somebody try to read this data, he will get a update value can later be rollbacked (if cache is not responding).
Thanks In Advance
What if some data that is saved in varnish cache is changed after sometime on backend server. Then when a request comes, then varnish return old data or updated data?
The old data, or to be clear: it returns the data as it was at the time when it was cached if the expiry time of the cached object has not yet been reached. If you want it to update before that time you need to purge or ban the item in the cache. See the chapter on Purging and banning in the varnish documentation for details on implementation.
I'm using hazelcast for distributed cache on top of mysql. I have a map to store user info, with MapStore config, sometime user info in db changed by other reason not from my app, I want to update cache without update to database.
How can I do?
You can use IMap.putTransient to update entry without persisting to MapStore. Alternatively you can just evict the entry with IMap.evict and on next get it will be loaded form the MapStore.
As above really, if I store something (e.g. website session data) in memcached, is it possible to remove the data securely so that it would not be evident in a later memory dump?
I assume delete just unassigns the memory rather than wiping it? Could I manually junk the allocated memory by updating the key with random data before deleting it?
Obviously encrypting the data before storing it would be a solution but this also adds a performance overhead.
You can't... Replacing a value is another allocation and will not overwrite the old value in memory.
Check the FAQ. So, if you want to secure your data, because you are in a hostile environment, use SASL authentication. Check it out: SASL
And make sure no one has access to memcached from the outside!!! Bind it to localhost.
Excerpt from the manual:
When do expired cached items get deleted from the cache?
memcached uses a lazy expiration, which means it uses no extra cpu
expiring items. When an item is requested (a get request) it checks
the expiration time to see if the item is still valid before returning
it to the client.
Similarly when adding a new item to the cache, if the cache is full,
it will look at for expired items to replace before replacing the
least used items in the cache.