cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Herrmann <frank.herrm...@modernizingmedicine.com>
Subject Re: QueryCache @CacheGroups Annotation
Date Wed, 03 Feb 2016 19:12:22 GMT
Hi Andrus,

Thanks for the quick reply. However, adding the filter didn't seem to work.
Below is my addition of the filter to our runtime.

public synchronized static void initialize(String cayenneConfig)
> {
> if(cayenneRuntime != null) {
> return;
> }
>
> if(logger.isInfoEnabled()) {
> logger.info("Loading cayenne domain config from " + cayenneConfig);
> }
>
> Module module = new M2CayenneModule();
> cayenneRuntime = new ServerRuntime(cayenneConfig, module);
>
> CacheInvalidationFilter cacheInvalidationFilter = new
> CacheInvalidationFilter();
> cayenneRuntime.getDataDomain().addFilter(cacheInvalidationFilter);


Here is the annotation on an object:

@CacheGroups("minimal_cache")
> public class StatusFirm extends _StatusFirm implements
> com.m2.domain.StatusFirm {
> }


However, when this object is returned during a find, it uses the default
cache group. Like I said, however, if I specify the cache group in the
code, it works. So I know ehcache is being used and is configured
correctly.

Thanks again for the help.

-Frank



On Wed, Feb 3, 2016 at 1:12 PM, Andrus Adamchik <andrus@objectstyle.org>
wrote:

> Hi Frank,
>
> For the annotation to get processed, you will need to add
> CacheInvalidationFilter to your ServerRuntime. Here is an example:
>
>
> https://github.com/andrus/wowodc13/blob/94ac0f4920a5f494c4e73de717c05e5a54302921/editor/src/main/java/demo/editor/services/cayenne/EditorCayenneService.java
>
> Hope this helps,
> Andrus
>
> > On Feb 3, 2016, at 7:55 PM, Frank Herrmann <
> frank.herrmann@modernizingmedicine.com> wrote:
> >
> > Hello All,
> >
> > I was wondering if there is anything special I might be missing to
> utilize
> > the @CacheGroups annotation for query caching. I have successfully gotten
> > Cayenne to use Ehcache for query caching. I have cache groups specified
> in
> > the ehcache.xml file. However, if I use the @CacheGroups annotation on an
> > object, it appears to be ignored. The caching still goes to the default
> > cache. If I specify the cache group in the code, i.e.
> > query.setCacheGroups(), everything works fine, and the cache group is
> > utilized.
> >
> > I am using Cayenne 3.1.
> >
> > Thanks to anyone who can point me in the right direction.
> >
> > -Frank
> >
> > --
> > FRANK HERRMANN
> > SOFTWARE ENGINEER
> >
> > T: 561-880-2998 x1563
> >
> > E: frank.herrmann@modmed.com
> >
> >
> >
> > [image: [ Modernizing Medicine ]] <http://www.modmed.com/>
> > [image: [ Facebook ]] <http://www.facebook.com/modernizingmedicine>
> [image:
> > [ LinkedIn ]] <http://www.linkedin.com/company/modernizing-medicine/>
> [image:
> > [ YouTube ]] <http://www.youtube.com/user/modernizingmedicine> [image: [
> > Twitter ]] <https://twitter.com/modmed_EMA> [image: [ Blog ]]
> > <http://www.modmed.com/BlogBeyondEMR> [image: [ Instagram ]]
> > <http://instagram.com/modernizing_medicine>
>
>


-- 
FRANK HERRMANN
SOFTWARE ENGINEER

T: 561-880-2998 x1563

E: frank.herrmann@modmed.com



[image: [ Modernizing Medicine ]] <http://www.modmed.com/>
[image: [ Facebook ]] <http://www.facebook.com/modernizingmedicine> [image:
[ LinkedIn ]] <http://www.linkedin.com/company/modernizing-medicine/> [image:
[ YouTube ]] <http://www.youtube.com/user/modernizingmedicine> [image: [
Twitter ]] <https://twitter.com/modmed_EMA> [image: [ Blog ]]
<http://www.modmed.com/BlogBeyondEMR> [image: [ Instagram ]]
<http://instagram.com/modernizing_medicine>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message