Giter VIP home page Giter VIP logo

jsr107-magnolia's Introduction

jsr107-magnolia

Build Status Maven Central

See

After installation you can cache the result of any method of any guice managed bean by adding the @CacheResult annotation.

@CacheResult(cacheName = "CinemaUtil-sortedMovies")
public List<Map.Entry<Movie, Set<RoleType>>> sortedMovies(Person person) {
   ...
}

In this case in the magnolia cache configuration automaticly a cache 'CinemaUtil-sortedMovies' will appear.

Possible cache values

The cache values may be null and Optional. This implementation will arrange that no nulls are stored in the underlying magnolia cache. If the value is Optional, the value of the Optional will be serialized.

Non serializable values are only possible if the underlying eh-cache is configured not to store to disk.

Model classes

Sadly, model classes are not instantiated by guice, but by Magnolia itself, so they cannot be proxied by guice.

##Installation

Download the most recent jar from: https://oss.sonatype.org/content/repositories/snapshots/nl/vpro/jsr107-magnolia and install it like you'd normally would.

Or you can add this to your pom.xml

<dependency>
  <groupId>nl.vpro</groupId>
  <artifactId>jsr107-magnolia</artifactId>
  <version>1.4</version>
</dependency>

###Configuration You can configure the create cache like so in the JCR-tree: cache configuration

Cache-configurations can be automaticly created like this using tasks on the version handler of your module. E.g.

@Slf4j
public class CinemaVersionHandler extends DefaultModuleVersionHandler {
 
    @Override
    protected List<Task> getBasicInstallTasks(InstallContext installContext) {
        List<Task> tasks = super.getBasicInstallTasks(installContext);
        tasks.addAll(CreateConfigurationTasks.createConfigurationTasks(CinemaUtilWithCaching.class));
        log.info("Created tasks {}", tasks);
        return tasks;
    }
}

jsr107-magnolia's People

Contributors

mihxil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.