• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jooby-project / jooby / 118 / 1
62%
2.x: %

Build:
Build:
LAST BUILD BRANCH: master
DEFAULT BRANCH: 2.x
Ran 02 Jun 2015 01:52AM UTC
Files 161
Run time 9s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Jun 2015 12:34AM UTC coverage: 99.053% (+0.04%) from 99.011%
118.1

push

travis-ci

jknack
ehcache module and session store #89

Provides advanced cache features via {{ehcache}}

* A ```CacheManager```
* Direct access to ```Ehcache``` instances

```xml
<dependency>
  <groupId>org.jooby</groupId>
  <artifactId>jooby-ehcache</artifactId>
  <version>{{version}}</version>
</dependency>
```

```java
{
  use(new Eh());

  get("/", req -> {
    CacheManager cm = req.require(CacheManager.class);
    // work with cm

    Ehcache ehcache = req.require(Ehcache.class);
    // work with ehcache
  });
}
```

{{ehcache}} can be fully configured from your ```.conf``` file and/or programmatically, but for the
time being there is no support for ```xml```.

Caches are configured via ```.conf``` like almost everything in {{jooby}}.

```properties
ehcache.cache.mycache {
  eternal = true
}
```

Later, we can access to ```mycache``` with:

```java
{
  get("/", req -> {
    Ehcache mycache = req.require(Ehcache.class);
  });
}
```

Multiple caches are also possible:

```properties
ehcache.cache.cache1 {
  maxEntriesLocalHeap = 100
  eternal = true
}

ehcache.cache.cache2 {
  maxEntriesLocalHeap = 100
  eternal = true
}
```

Later, we can access to our caches with:

```java
{
  get("/", req -> {
    Ehcache cache1 = req.require("cache1", Ehcache.class);
    // ..
    Ehcache cache2 = req.require("cache2", Ehcache.class);
    // ..
  });
}
```

Previous examples, show how to configure two or more caches, but it is also possible to inherit
cache configuration using the ```default``` cache:

```properties
ehcache.cache.default {
  maxEntriesLocalHeap = 100
  eternal = true
}

ehcache.cache.cache1 {
  eternal = false
}

ehcache.cache.cache2 {
  maxEntriesLocalHeap = 1000
}
```

Here ```cache1``` and ```cache2``` will inherited their properties from the ```default``` cache.

Please note the ```default``` cache works as a template and isn't a real/usable cache.

This module provides an [EhSessionStore]({{defdocs}}/ehcache/EhSessionStore.html). In order to use the [EhSes... (continued)

6171 of 6230 relevant lines covered (99.05%)

0.99 hits per line

Source Files on job 118.1
  • Tree
  • List 0
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 118
  • Travis Job 118.1
  • c6f3a5e2 on github
  • Prev Job for on master (#117.1)
  • Next Job for on master (#120.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc