How to change Infinispan cache settings after it is created? - caching

In my application i'm using Infinispan 5.3 version and I want to change setting after cache is initialized. Default settings will be loaded from xml file and some of the settings ( ex : eviction maxEntries, lifespan, etc ) should be able to change any time of application running (This is changed by sysadmin). Is there way to changed settings of already created cache ?
I tried EmbeddedCacheManager.defineConfiguration(String cacheName, Configuration configurationOverride); but this has no effect on already created cache.

Please, take into account that in the Infinispan version 5.3 there is no possibility to change cache configuration "on the fly". You need to restart your service with new configuration in case of any wanted change.
This is something the community might want to work on in the future. However, such a task is not easy because you need to figure out how to correctly deal with affected data immediately after the configuration change.
Feel free to raise new feature request: https://issues.jboss.org/browse/ISPN/

Related

How to update Abp Permission Cache for each application

I have multiple services (Administration.Api, Project.Api)
Administration service is managing permissions (create,update).
But i have a problem about caching, when i update permissions through Administration.Api, Project api's cache Permission grant don't change immediately(it's grant change after 20minutes, when cach removed automatically)
I want to change all permission cache under different cache prefixes immediately. How can i fix this?
You really need a true distributed cache service (like Redis) to do this properly. That way a cache-dump for one affects all services.
There are other solutions you could try, but really they are just bandaids, and more work with potential other sideeffects.
use a message bus to notify all services of the permission change and to dump their in-memory cache
use a new shared db table to add a new row with "LastUpdated". The permission service would need to write the updated time when permissions changed. Each service would need to query this table to check for a newer updated time (on each request), and dump in-memory cache if exists.
You can use AbpDistributedCacheOptions to change default cache settings and add prefix to your application for caching.
Configure<AbpDistributedCacheOptions>(options =>
{
options.GlobalCacheEntryOptions = new DistributedCacheEntryOptions()
{
AbsoluteExpiration = //20 mins default
};
options.KeyPrefix = "MyApp1";
});
You can also extend override permission management providers, such as RolePermissionManagementProvider and handle cache invalidation.
Docs about permission management providers: https://docs.abp.io/en/abp/latest/Modules/Permission-Management#permission-management-providers
One application has ONE ABP default cache (we are not talking about global caches like Redis now). So to have a single control of different applications caches, you can use RabbitMQ: you have a RabbitMQ queue in each application, named something like "abp-cache[appName]". In RabbitMQ receiver, you send messages to EACH of these queues. In the RabbitMQ receiver of the specific app, you handle the received message. I've already implemented this mechanism to update ABP permission cache for all my apps. Everything is easily wrapped inside Extensions Nuget package.

Disabling/Pause database replication using ML-Gradle

I want to disable the Database Replication from the replica cluster in MarkLogic 8 using ML-Gradle. After updating the configurations, I also want to re-enable it.
There are tasks for enabling and disabling flexrep in ML Gradle. But I couldn't found any such thing for Database Replication. How can this be done?
ml-gradle uses the Management API to handle configuration changes. Database Replication is controlled by sending a PUT command to /manage/v2/databases/[id-or-name]/properties. Update your ml-config/databases/content-database.json file (example that does not include that property) to include database-replication, including replication-enabled: true.
To see what that object should look like, you can send a GET request to the properties endpoint.
You can create your own command to set replication-enabled - see https://github.com/rjrudin/ml-gradle/wiki/Writing-your-own-management-task
I'll also add a ticket for making official commands - e.g. mlEnableReplication and mlDisableReplication, with those defaulting to the content database, and allowing for any database to be specified.

How to add entries in Application.conf during runtime?

How to add separate redis cache instances at runtime?
Manually one can add multiple redis cache instances in this way
Application.conf:
redis.uri="redis://192.168.3.170:6000"
# disable default Play framework cache plugin
play.modules.disabled = ["play.api.cache.EhCacheModule"]
# enable redis cache module
#play.modules.enabled = ["play.api.cache.redis.RedisCacheModule"]
#Multiple redis caches
play.cache.redis.bindCaches = ["cache1","cache2","cache3"]
How if I need to add one more cache say cache4 during runtime?
I have tried through ConfigFactory.load.entrySet() and Config class.
You can't do it since Config is immutable. Also, keep in mind that your redis cache implementation would need to listen to configuration changes in order to recognize the new cache.
Maybe a better way is to have this built into Redis module. In other words, you would be able to do something like redis.addCache("cache4").

How to clear cache in Pentaho

I am using Pentaho 5. My dimensions keep changing frequently and I need the changes to be applied to the dashboard, this is not possible because Pentaho keeps caching. I have created the cube using the datasource wizard and the querys using mdx over mondrian jndi. Even though I set the property Cache to false or set cache duration doesn't seem to work. Is there a API that I can use with mondrian jndi to clear cache? Or are there any property files that I should change? Please help.
In Pentahoo 7 the "Clear Cache" option is in a different Menu:
Tools -> Database -> Clear Cache
If you are using Database lookup and if you are getting older fields, cleaning cache can actually solved the problem.
It worked for me.
You can do it manually inside Pentaho User Console: Tools -> Refresh -> Mondrian Schema Cache.
Or you can make schedule for refreshing cache: find clear_mondrian_schema_cache.xaction inside your installation and schedule it.
Option 1:
You can read http://javadoc.pentaho.com/bi-platform500/webservice500/ for api details.
And also you can refresh Reporting Metadata Cache via web service, you can use the following web service call:
http://localhost:8080/pentaho/api/system/refresh/metadata
Option2: You can navigate to \biserver-ee\tomcat\webapps\pentaho\WEB-INF\classes
and change the configuration file "ehcache.xml"
<cache name="report-dataset-cache"
maxElementsInMemory="50"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="1"
timeToLiveSeconds="2"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="1"
/>
If you have done that and still no positive answer, I think you have not restarted the BA server. If the issue still exists comment below.
There are 2 options
One is to schedule "clear mondrian schema" on ba server but for that to happen , you need to get clear_mondrian_schema.xml from pentaho-solutions/systems folder and upload it in some folder that you can access on ba server. You can then use normal schedule file options to achieve you want. This put a lof of load on BA server though.
My second recommendation is if you are using cubes/schema and building using schema workbench, you can turn the caching off. If your database is architecturally good and your schemas all well defined, user will get updates/new data as soon as they refresh.

How do I disable Symfony from writing _sess files to my /tmp directory

I am new to symfony and am responsible for a site that I didn't build. For some reason the site is on a live server but running in dev mode. - Im not sure why??
That aside - The website keeps writing _sess files to my /tmp directory. The contents of each _sess file is exactly the same. See below:
_symfony2|a:3:{s:10:"attributes";a:0:{}s:7:"flashes";a:0:{}s:6:"locale";s:2:"en";}
Do I really need all of these files? Can anyone suggest a way of disabling this feature?
Thanks in advance
The default session storage of Symfony2 writes the session information to file(s). The location these files are written to is determined by the config parameter framework.session.save_path. The default value for this is %kernel.cache.dir%/sessions. This means that in a default installation of symfony the session files would be written to the cache directory for the environment.
However, this can be a problem as the cache directory has to be cleared each time an app is deployed, thus logging all the users out. Therefore presumably your app has been configured (most likely in config.yml) to store the session files in /tmp.
As I understand it, sessions that have expired should be garbage-collected at some point. Symfony also has some config params that affect this - see the FrameworkBundle Configuration. I don't know how much traffic your website has but obviously you do need the session files for active sessions. If you think you have a lot of expired sessions you could try tweaking the gc config params.
Alternatively, if having the session files in /tmp is specifically the problem you could relocate them (by changing the value of the framework.session.save_path) or use PDOSessionHandler to store sessions in the database.
I have this problem with symfony 1.4.20 on a web site I inherited.
It is writing files to
/var/lib/php/sessions
every second, until the server runs out of iNodes.
I've tried changing settings in settings.yml. app.yml and PHP session variables.
Nothing sees to be working though, the only way I can stop it is to change the ownership of /var/lib/php/sessions to root and that prevents any session files being created.

Resources