How does the Mule caching strategy know when the data has changed? - caching

I'm looking at the cache scope for Mule 3.8.1 in Anypoint Studio 6.1 and wanted to know if/how the caching detects changes to the data?
I see there is a Time to Live and Expiration times which are useful so it is not checking all the time but how can Mule caching be set up to detect changes as if e.g. the data is incorrect in the database and is then fixed I wouldn't want to have to wait an hour or have to redeploy the application to see the change if I can help it.
Thanks

As far as i can think you need to invalidate your cache by yourself, if you want the data to be loaded again. Since its your data you know when it is changed and you can trigger the invalidation.
https://docs.mulesoft.com/mule-user-guide/v/3.8/cache-scope#invalidating-a-cache

Related

Updating global.xml on disk doesn't update geoserver config

I'm using geoserver 2.19 and tried to update directly global.xml to update the contact information but when reloading the cache, it just discards my changes and writes back the global.xml without my changes.
I tried modifying the logging.xml as well, the change I made is visible in the GUI when reloading the cache but is not really adapting the logs as per the modifications I've made.
Am I missing something?
To give a bit more information, I have 2 instances of Geoserver and when I make changes to 1 instance, I call the rest reload to apply the changes on the other instances too. I've read about JMS clustering but it seemed a bit too complex and rigid for what I need to do. Advices are welcome.
I am trying to achieve this : https://docs.geoserver.geo-solutions.it/edu/en/clustering/clustering/passive/passive.html. But I'm having trouble with the synchronization between the instances
Thank you
Basically, don't do that! GeoServer manages that file and you can break things very badly if you mess with that file.
You should only change things like contact information through the GUI or the REST API.

Can weblogic cache reponses to get requests?

I don't mean using coherence. I am looking for a way to avoid hitting my application to look something up that I've already looked up. When the client performs a GET on a resource I want it to hit the application the first time only and after that return a cached copy.
I think I can do this with apache and mod_mem_cache, but I was hoping there was a weblogic built in solution that I'm just not able to find.
Thanks.
I don't believe there's inbuilt features to do that across the entire app server, but if you want to do it programmatically, perhaps CacheFilter might work.

Cache eviction at particular time of the day and not through TTL

Please let me know if cache eviction can be done at particular time of the day instead of TTL. I am using spring framework so if any API provides this feature then I can use this API by plugging into Spring.
I did run through search mechanism if similar question has been asked but failed to find any prior question.
If similar question has been asked please let me know the link.
Thanks, Amitabh
According to GemFire docs:
You configure for eviction based on entry count, percentage of
available heap, and absolute memory usage. You also configure what to
do when you need to evict: destroy entries or overflow them to disk.
See Persistence and Overflow.
http://gemfire.docs.pivotal.io/latest/userguide/index.html#developing/eviction/configuring_data_eviction.html
But you may be able to get something closer to what you need through Custom expiration. Please check the following link:
http://gemfire.docs.pivotal.io/latest/userguide/index.html#developing/expiration/configuring_data_expiration.html
Ehcache expiration does not offer such a feature out of the box.
You still have some options:
Configure the TTL when creating the Element with a computed value.
Use refresh-ahead or even better scheduled refresh ahead
Have a look at the following question. Note that this may not work with all configurations as sometimes the Element gets re-created internally.

caching a query that changes infrequently in Coldfusion/cfWheels

I'm looking at the cache function in the findAll function of cfWheels. I'm a little apprehensive about using it. My queries are not taking that long that I absolutely need them, but a bit of a speed boost is always welcome. I'm getting 10ms from a queried cache that otherwise takes about 100ms. The thing I'm wondering about is when an entry changes, I'd like the cache to be cleared on the next run. It doesn't seem like there's any mechanism or flag in the framework that would allow that, so I'd have to set and clear the flags myself, which would most likely end up having to read from the database anyway. I was hoping that I could set the cache for a full day and update when needed, is this horribly misguided? I'm most likely not going to go down the road of developing any of the functionality to allow the caching for this application, but am curious if it is worth while revisiting.
More precisely whenever you make a new entry in the database, use the cfhttp tag to reload the application.
Caching can be cleared through reloading an application. It would not be the answer you are seeking but is a solution, here is an another approach. You can reload an application through <CFHTTP> by sending URL through <CFHTTP> after adding your new database record. If you are adding record through management site, then you can reload your Public site using <cfhttp>.
:)

Can/Should I disable the cache expiry when backing data store is unavailable?

I'm just started out with Ehcache, and it seems pretty good so far. I'm using it in a simplistic fashion to speed up reads against a database, but I wonder whether I can also use it to let the application stay up if the database is unavailable for short periods. (Update - my context is a application with high-availability modules that only read from the database)
It seems like I could do that by disabling expiry in the event of a database read problem, and re-enabling it when a read works again.
What do you think? Is that a reasonable approach or have I missed something? If it's a fair approach, any tips for how best to implement appreciated.
Update - ehcache supports a dynamically configurable option to un/set the cache to 'eternal'. This seems to do what I need.
Interesting question - usually, the answer would be "it depends".
Firstly, if you have database reliability problems, I'd invest time and energy in fixing them, rather than applying a bandaid solution.
Secondly, most applications need both reading and writing to work - it doesn't seem to make sense to keep your app up for reads only.
However, if your app has a genuine "read only" function, and there's a known and controlled reason for database down time (e.g. backups), then yes, you can use your cache to keep the application up and running while the database is down. I would do this by extending the cache periods, rather than trying to code specific edge cases. For instance, you might have a background process which checks whether the database is available and swaps in a different configuration file when there's trouble.

Resources