smartcache

SmartCache - cache that can survive everything.

License

License

Categories

Categories

Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

org.kielo.smartcache
ArtifactId

ArtifactId

smartcache-metrics
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

smartcache
SmartCache - cache that can survive everything.
Project URL

Project URL

https://github.com/kielo/smartcache
Source Code Management

Source Code Management

https://github.com/kielo/smartcache

Download smartcache-metrics

How to add to project

<!-- https://jarcasting.com/artifacts/org.kielo.smartcache/smartcache-metrics/ -->
<dependency>
    <groupId>org.kielo.smartcache</groupId>
    <artifactId>smartcache-metrics</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.kielo.smartcache/smartcache-metrics/
implementation 'org.kielo.smartcache:smartcache-metrics:0.3.0'
// https://jarcasting.com/artifacts/org.kielo.smartcache/smartcache-metrics/
implementation ("org.kielo.smartcache:smartcache-metrics:0.3.0")
'org.kielo.smartcache:smartcache-metrics:jar:0.3.0'
<dependency org="org.kielo.smartcache" name="smartcache-metrics" rev="0.3.0">
  <artifact name="smartcache-metrics" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.kielo.smartcache', module='smartcache-metrics', version='0.3.0')
)
libraryDependencies += "org.kielo.smartcache" % "smartcache-metrics" % "0.3.0"
[org.kielo.smartcache/smartcache-metrics "0.3.0"]

Dependencies

compile (4)

Group / Artifact Type Version
com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-lru jar 1.4
io.dropwizard.metrics : metrics-core jar 3.1.2
org.slf4j : slf4j-api jar 1.7.7
org.kielo.smartcache : smartcache-core jar 0.3.0

test (4)

Group / Artifact Type Version
com.jayway.awaitility : awaitility jar 1.6.3
ch.qos.logback : logback-classic jar 1.0.13
org.spockframework : spock-core jar 1.0-groovy-2.4
ch.qos.logback : logback-core jar 1.0.13

Project Modules

There are no modules declared in this project.

SmartCache

SmartCache is reliable cache that can protect your application from 3rd party systems failure.

Motivation

Big problem of integrating with external services is protecting against downtimes. If external service is not mission critical or used deeply in backend, we can just wait. In other cases it is enough to inform the user about problems and again wait for solution.

However, there is a group of systems that need to integrate with external services and at the same time 99.99999% accessibility time is a must. Sometimes freshness of data doesn't matter, as long as system can stay operable during external vendor blackout. SmartCache is a lightweight library that wants to help solve this problem.

How does it work?

Usual cache works on objects - naive implementation is as simple as associate object V with key K and store it. SmartCache operates on callable actions instead. When getting item from cache, you actually need to provide action that can resolve it. If result of this action is already cached, it is returned without calling possibly long-running action. Otherwise action is called and unless it exceeds configurable timeout or other exception is thrown, result of action is returned and stored in cache.

SmartCache protects against calling multiple same actions simultaneously using action aggregation.

How to use it?

SmartCache cache = new SmartCache(Executors.newCachedThreadPool());
cache.registerRegion(new Region("region", new TimeExpirationPolicy(10000), 5));

T value = cache.get("key")
                .fromRegion("region")
                .withTimeout(Duration.ofMillis(1000))
                .invoke(() -> { /* action */ });

License

SmartCache is published under Apache License 2.0.

org.kielo.smartcache

kielo.org

Versions

Version
0.3.0