caching,annotations,ehcache,spring-annotations,spring-cache , Difference between @CacheEvict and @TriggersRemove annotations


Difference between @CacheEvict and @TriggersRemove annotations

Question:

Tag: caching,annotations,ehcache,spring-annotations,spring-cache

I want to use Ehcache in my portlet application. If I want to remove data from cache, it is better to use @CacheEvict or @TriggersRemove?

According to documentation it looks like @CacheEvict and @TriggersRemove annotations are very similar.


Answer:

disclaimer: I am working on the Spring caching abstraction (amongst other things).

These are two annotations from two different projects. I don't know much about TriggersRemove but from what I can see, it is ehcache specific.

The caching abstraction in the Spring Framework is completely decoupled from the underlying infrastructure so you can use that with basically any caching library out there, including ehcache. If you want your code to be independent from the caching library you use, I'd advise not to use TriggersRemove. If that's not a problem for you, check the documentation of each solution and choose accordingly.


Related:


App Not Downloading Newest Version Of File [Java]


java,caching,download
Okay, I've been trying to figure this out for a few hours and it's starting to kill me. I wrote a primitive version checker for an app I work on every once and awhile. It's just a simple for fun project. The version checker has been a pain though. It...

How to use a dynamic value for cache key with ActiveModel::Serializers (v0.10.0.rc1)


caching,active-model-serializers,rails-api
I am using a database-driven solution for labels and translations that I would like to cache at the serializer level. Here is my serializer. class AppLabelSerializer < ActiveModel::Serializer cache key: 'app_label', expires_in: 3.hours attributes :id, :key, :label, :label_plural def key object.app_label_dictionary.key end end The problem is that I need to...

Why does the expiration date of the request cache lie in the past?


firefox,caching,firebug
I am working on caching some pages and I noticed this in Firebug: So it says that the cache expired 45 years ago. Is this a bug or some bad data? I have another page that is caching correctly I just do not understand why its saying Expires ... 1970....

Django localmem size


python,django,caching
What is the default size of the local memory cache for Django. https://docs.djangoproject.com/en/1.8/ref/settings/ does not mention any. https://docs.djangoproject.com/en/1.8/topics/cache/#cache-arguments says it is 300, but the following code always returns a different value: for i in range(0, 10000): cache.set(i, i) first = cache.get(0) if first is None: print i break I have...

Unzipping Multiple Files - Java


java,caching
I'm working on an auto updater for a game client and I've run into an issue. What I need it to do: Download cache.zip and client.zip. Extract cache.zip to cacheDir and extract client.zip to the same location they are running the jar(game). What it does right now: Downloads both cache.zip...

Ambiguous mapping found when I use extends clause


java,spring-mvc,inheritance,annotations
I have a CustomerController and CustomerCardController classes that extend CrudMethods class. I choose so, because these two controller use the same methods (getFileCustomer() is one of these). And I thought that it had been better use the inheritance to save code's rows. CustomerController @Controller public class CustomerController extends CrudMethods {...

android json data to spring mvc4


java,android,json,spring-mvc,annotations
I am new to using Spring mvc4 annotation . In all i want to do is using spring mvc as a web service . so i would be thankful if anyone could provide me a solution for it. My android code is as: HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 5000);...

Adding a pin annotation to a map view on a long press in swift


ios,swift,annotations,maps,mkmapview
I'm trying to make an iPhone app which requires users to be able to long press on a place on a map view to drop a pin there. Does anybody know how this is done? The behaviour is observable in apple maps when you long press on the screen. It...

Cache inconsistency - Entity not always persisted in cached Collection


java,hibernate,jpa,caching,ehcache
I'm having an issue where a Validation instance is added to a Collection on a Step instance. Declaration is as follows: Step class: @Entity @Table @Cacheable @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Step extends AbstractEntity implements ValidatableStep { @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "step_id", nullable...

Dynamic annotation/attribute values


c#,validation,annotations,attributes
I run into a problem using data annotations in c#. I am using custom required and range attributes and I want to set an object as the error message. [MyOwnRequired(ErrorCode=GlobalMessages.Message01] public string Description { get; set; } The problem is that I do have a class holding several objects (GlobalMessages.Message01,...

Caching Views in XAML changes appearance?


xaml,caching,windows-store-apps
I'm caching Views in XAML in order to improve performance (don't need to load the controls again). Does this make sense / improve performance of loading controls? Problem is, although I'm caching / loading the same thing, it seems when I use the Cached View, it has a different appearance....

How can I cache my website in the user's browser?


javascript,html5,caching
I've found many explanations about caching, some of them even have examples but, it is kind of foggy to understand it and how to use it. I've tried to use it many times, but I've failed (I want to improve speed, I want only the necessary to be loaded from...

PlayFramework 2.2.6. Default cache expiration


java,caching,playframework-2.2
I would like to store Java object in cache for user session. I would like to know what is default cache storage timeout. I user log in on 8.00 am I will store his user object in cache. Will it keep f.e. 10 hours until user will logout? Will be...

yii2 disable page cache on post request


php,caching,yii2,yii2-advanced-app
I have a page where I submit a form that I want to cache but only for get requests. I cannot figure out if there is a way to do this but the Yii2 guide seems to hint at it http://www.yiiframework.com/doc-2.0/yii-filters-pagecache.html#$enabled-detail, it says you can enable it only for Get...

scalacache memoization asynchronous refresh


scala,caching,memoization
I'd like to do a TTL based memoization with active refresh asynchronously in scala. ScalaCache example in the documentation allows for TTL based memoization as follows: import scalacache._ import memoization._ implicit val scalaCache = ScalaCache(new MyCache()) def getUser(id: Int): User = memoize(60 seconds) { // Do DB lookup here... User(id,...

Annotator dependencies: UIMA Type Capabilities?


java,annotations,nlp,uima,dkpro-core
In my UIMA application, I have some annotators that must run after a certain annotator has run. At first, I thought about aggregating these annotators together, but I have other annotators that are also dependent on this (and other) annotator, which makes aggregating hard and/or unpractical. I read about Type...

Understanding Memory Replays and In-Flight Requests


caching,cuda
I'm trying to understand how a matrix transpose can be faster reading naively from columns vs. rows. (example is from Professional CUDA C Programming) The matrix is in memory by row, i.e. (0,1),(0,2),(0,3)...(1,1),(1,2) __global__ void transposeNaiveCol(float *out, float *in, const int nx, const int ny) { unsigned int ix =...

Cache ruining Jquery Code?


javascript,jquery,caching
My problem might be naive, but basically I have a simple Jquery script running on a site to determine the margin height of divs based on the contained image's height: <script type="text/javascript"> $('.artobject').css('margin-bottom',$('.img-wrap').height()); </script> The problem is that it runs once, but after the page is reloaded the code begins...

PHP How to not cache generated HTML but cache static data like images/js/css


javascript,php,css,image,caching
Many PHP developers add the no-cache header on top of their PHP pages, so do I, for obvious reasons. Since PHP generated content is usually dynamic, having the browser cache them results in outdated data being presented to the user. To avoid this caching is usually disabled. <?php //no cache...

Get id column name from POJO, using reflection


java,jpa,reflection,annotations
@Entity @Table(name="MY_TABLE") public class MyTable{ @Id @Column(name="MY_TABLE_ID") @GeneratedValue(strategy = GenerationType.AUTO ,generator="SQ_MY_TABLE") @SequenceGenerator(name="SQ_MY_TABLE", sequenceName="SQ_MY_TABLE") private Long myTableId; How can I, using reflection, get the primary key column name from my POJO, defined with the javax.persistence.Id annotation? I'd have to find the @Id and then get the name property of the @Column...

What does `expires -1` mean in NGINX `location` directive?


caching,nginx,cache-control
Given the sample location example below, what does -1 mean for expires? Does that mean "never expires" or "never caches"? # cache.appcache, your document html and data location ~* \.(?:manifest|appcache|html?|xml|json)$ { expires -1; access_log logs/static.log; } https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/expires.conf...

Does setting beresp.ttl to 0s replace previous cache?


caching,varnish,varnish-vcl
I have this issue, I use Varnish 3.0 and I want to avoid caching errors. I'm aware that this piece of code should do it: if (beresp.status >= 500) { set beresp.saintmode = 2m; if (req.request != "POST") { set beresp.ttl = 0s; return(restart); } else { set beresp.ttl =...

How to call posts from PHP


php,wordpress,caching,cron,call
I have a website, that uses WP Super Cache plugin. I need to recycle cache once a day and then I need to call 5 posts (URL adresses) so WP Super Cache put these posts into cache again (caching is quite time consuming so I'd like to have it precached...

The process cannot access the file because it is being used by another process asp.net [duplicate]


c#,asp.net,asp.net-mvc,caching,system.io.file
This question already has an answer here: “The process cannot access the file because it is being used by another process” with Images 6 answers I have the following method which resizes a given image and caches it [OutputCache(Duration = 3600, VaryByParam = "id")] public ActionResult UserFace(int id) {...

Is processor cache flushed during context switch in multicore?


caching,multicore,volatile,flush,context-switch
Recently, I discussed why there is a volatile mark at seq in Java Actors demo @volatile private var seq = 0L private def nextSeq: Long = { val next = seq seq += 1 next } One answer was that threads can be migrated and variables lost (other cores will...

Caching in Webview is not working in Android


android,caching,webview,browser-cache,offline-caching
When I open webview, it runs great when there is a network connection, but I have enabled caching in it, and without a network connection, it shows an error and loaded cached web page is not showing. I have enabled caching and also set cache mode, but it's not working....

What should I annotate when I unit test the GPS function with Robolectric?


unit-testing,annotations,robolectric
I am referring the following site http://googletesting.blogspot.ca/2010/12/test-sizes.html . There it was mentioned that we should annotate @LargeTest if our test method is accessing the network feature. I am using Roboloectric for unit testing. And my method uses the shadowLocationManager to simulate the GPS location. I am not sure what should...

Hibernate Query cache invalidation


java,hibernate,jpa,caching,concurrency
I am using Hibernate(with JPA) in an application that has a high write-read ratio. For caching I have enabled query-cache and hibernate second level cache(ehcache). The problem I am facing is due to automatic query cache invalidation when an update is done. Is there any way to configure query cache...

How can clear apache cache?


apache,caching
How can I clear apache cache in xammp? I tried the 'htcacheclean -r' command, but it's always generated error. If I know well the apache can't cache the files/ scripts, but a system administrator said this: 'The apache casheing the site, so clear the apache(!) cache.'. ...

Filter array based on coordinate from mapview frame in objective C


ios,objective-c,xcode,annotations,mkmapview
I have hundred's of map annotation. Annotation are from array of dictionary with lat and long val same data shown in table view. Table view and map view are same view based on screenheight/2. What I need for example in my array have 100 lat and long value table view...

How to get @interface parameter in jersey WriterInterceptor Implementation


java,annotations,jersey,jax-rs,interceptor
I have an interface, for example @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface AutoLogged { boolean query() default false; } How can I get query parameter in interceptor implementation? @Provider @AutoLogged public class AutoLoggedInterceptor implements WriterInterceptor { @Context private ResourceInfo resourceInfo; @Override public void aroundWriteTo(final WriterInterceptorContext context) throws IOException, WebApplicationException { try {...

Website html doesnt update for users because of cache


html,caching,browser-cache
I am making a website and am running into an issue with website cache for my users. I develop my website and have set chrome developer tools to disable cache for my website for development. The issue is when i release a new change to prod all my users don't...

How to omit creating static Map for data caching?


java,caching,static,hashmap
I want to know if it is possible to omit creating cache with static Map instance. Here is snippet of my class: public class XpathEvaluator { private DocumentBuilder builder; private XPath path; private Document document; private static Map<String, List<String>> cachedXpaths = new HashMap<>(); private XpathEvaluator() throws ParserConfigurationException { DocumentBuilderFactory factory...

AFNetworking 2.0 Cache Issue


ios,objective-c,caching,afnetworking
Does AFNetworking cache still work for objective-C? I have been trying to cache API response using AFNetworking, but it seems not to work anymore. AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSString *requestURL = [NSString stringWithFormat:@"http://ssssssssss.com"]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; [manager.requestSerializer setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; [manager GET:requestURL parameters:nil...

How to automatically format PHP annotations in PHPStorm


php,annotations,phpstorm,swagger-php
I'm working with a large number of files that have PHP block docs with Swagger PHP annotations on them, however they are not indented. Is there anyway to automatically format them with spaces? Turning /** * @SWG\Api( * path="/building/{buildingId}", * @SWG\Operation( * method="GET", * type="Building", * summary="Returns a Building object...

Yii2 : how to cache active data provider?


php,caching,yii2,dataprovider
In my PostSearch model I have this code : public function search($params) { $query = Post::find()->where(['status' => 1]); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort'=> ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => [ 'pageSize' => 10, ] ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere([ 'id' =>...

Elastic Beanstalk Prevent Files Overwriting


wordpress,git,caching,amazon-web-services
So a little background i am trying to setup a local staging and production environment using Elastic Beanstalk and Wordpress. So i have a local environment setup with git and i have the following in the .gitignore. ################# ## WordPress ################# .git-rewrite/ local-config.php .elasticbeanstalk/ Linux/ I have the ELB CLI...

Why must a setter be empty, if the property uses annotation attributes?


c#,annotations,setter
i want to use the setter to auto-correct the value and want to use the RequiredAttribute too. But in this case the RequiredAttribute do not work, because the setter is not empty. So, why have the setter to be empty? [Required(AllowEmptyStrings = false, ErrorMessage = "The Name cannot be empty....

Cache expires although explicitly set not to expire


c#,asp.net,caching
I have plenty of available ram (about 25 GB of free memory) and I don't want the cache to expire and I just remove and recache items when there is a change.As my website is in testing process it has 1 or 2 KBs of cached items but when I...

Generic Object Cache


c#,linq,caching
I am working on a project where I plan on using Redis as persistent data storage, however the task at hand, I am working on a generic Object cache. and as a huge fan of LINQ I have started designing a cache which does support this. public ConcurrentBag<Object> Cache =...

Specify user handlers for JAX-RS when using annotation scanning


rest,annotations,websphere-liberty,apache-wink
How to specify user handlers for JAX-RS when using annotation scanning? I am following this link and have created my custom handlers. I have annotated my Application subclass as: @ApplicationPath("rest") public class RestfulResourceLoader extends Application { } so that I don't have to entry in web.xml file. What I am...

Caching issue in angularJS application


angularjs,caching,orm,eloquent,slim
I've an admin panel which is a pure angularJS application, which uses REST api for data manipulation. REST api is built using SlimAPI framework and Laravel's Eloquent ORM. I'm facing caching issue in admin panel. Even though if a add new content to the system, it'll not show up in...

Angular ng-repeat cache (avoid re-rendering on state change)


javascript,angularjs,performance,caching,angularjs-ng-repeat
We have huge rendering spikes with ng-repeat in Angular application. Main page shows a huge list of cover images ("::" and "track by" are in place). On first load it works acceptable. But if user changes the state (we use UI-Router) and goes back to the home page afterwards then...

In what use cases is locking on ASP.NET cache required/desirable


c#,asp.net,caching
When inserting and retrieving items into cache. Is it best practice to perform a lock on the cache. I've following the guidelines from the following post. What is the best way to lock cache in asp.net? But i'm keen to get some context on whether i need to lock or...

“client not initialized” error when using SSMCache with AWS elasticache autodiscovery


caching,amazon-web-services,amazon-elasticache,spring-cache
I am using Spring cache with AWS elasticache provider. I get this warning: WARN c.g.code.ssm.spring.SSMCache - An error has occurred for cache defaultCache and key java.lang.IllegalStateException: Client is not initialized at net.spy.memcached.MemcachedClient.checkState(MemcachedClient.java:1623) ~[elasticache-java-cluster-client.jar:na] at net.spy.memcached.MemcachedClient.enqueueOperation(MemcachedClient.java:1617) ~[elasticache-java-cluster-client.jar:na] at net.spy.memcached.MemcachedClient.asyncGet(MemcachedClient.java:1013)...

How to get full return type forwarding in Xtend's Active Annotations?


java,android,annotations,xtend
I'm trying out Xtend's Active Annotations by writing a simple "Logged" annotation for tracing when methods have been called. Basically I want to write this in Xtend: @Logged override onCreate() { sampleFuncCall() } and get something like this in Java: @Override void onCreate() { Log.d("TAG", "onCreate started"); sampleFuncCall(); Log.d("TAG", "onCreate...

How to add Coordinates to CLLocationCoordinate2D from Dynamic NSMutableArray?


ios,objective-c,annotations,nsmutablearray,mkmapview
I have a MapView in which I would like to add annotations and a route from defined coordinates that I add from a Textfield and store in an NSMutableArray. Now I'm able to show the route from multiple coordinates but only when I insert them in my code as follow...

Prevent Caching of PDFs in ASP Classic


pdf,caching,asp-classic
I just started to manage a website for the company I work for and it is still running with ASP Classic so I have had to learn quite a bit. Recently our managment has started to post a dynamically updated PDF to the website every few hours. The problem I...

How can I specify the type of the field that an Annotation should be applied to in Java?


java,android,reflection,annotations
I'm creating a simple annotation, to help me inflating settings inside my Android application. The annotation is this: @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface CoreSettings { String name() default ""; } I want to ensure it will only be used in fields which type extends a custom class named BaseSettings. In the...

Detemine memory used by Hazelcast cache


java,caching,memory,hazelcast
I'm implementing the backend of a game in Java and I was told to use Hazelcast to cache some data from the database. How could I find out how much memory is used by the cache (necessary to determine the business cost of this solution)?