sciurus-cache-redis

This is an implementation of Sciurus' CustomCache for Redis.

License

License

Categories

Categories

Redis Data Databases
GroupId

GroupId

io.mcarle
ArtifactId

ArtifactId

sciurus-cache-redis
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

sciurus-cache-redis
This is an implementation of Sciurus' CustomCache for Redis.
Project URL

Project URL

https://github.com/mcarleio/sciurus-cache-redis
Source Code Management

Source Code Management

https://github.com/mcarleio/sciurus-cache-redis

Download sciurus-cache-redis

How to add to project

<!-- https://jarcasting.com/artifacts/io.mcarle/sciurus-cache-redis/ -->
<dependency>
    <groupId>io.mcarle</groupId>
    <artifactId>sciurus-cache-redis</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.mcarle/sciurus-cache-redis/
implementation 'io.mcarle:sciurus-cache-redis:1.0.0'
// https://jarcasting.com/artifacts/io.mcarle/sciurus-cache-redis/
implementation ("io.mcarle:sciurus-cache-redis:1.0.0")
'io.mcarle:sciurus-cache-redis:jar:1.0.0'
<dependency org="io.mcarle" name="sciurus-cache-redis" rev="1.0.0">
  <artifact name="sciurus-cache-redis" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.mcarle', module='sciurus-cache-redis', version='1.0.0')
)
libraryDependencies += "io.mcarle" % "sciurus-cache-redis" % "1.0.0"
[io.mcarle/sciurus-cache-redis "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
io.mcarle : sciurus jar 1.1.0
io.lettuce : lettuce-core jar 5.1.8.RELEASE
org.apache.logging.log4j : log4j-slf4j-impl jar 2.12.1

test (7)

Group / Artifact Type Version
com.google.code.gson : gson jar 2.8.5
org.junit.jupiter : junit-jupiter-engine jar 5.5.1
org.junit.jupiter : junit-jupiter-params jar 5.5.1
org.hamcrest : hamcrest jar 2.1
org.mockito : mockito-core jar 3.0.0
org.mockito : mockito-junit-jupiter jar 3.0.0
org.apache.logging.log4j : log4j-core jar 2.12.1

Project Modules

There are no modules declared in this project.

Sciurus Cache Redis

This is an implementation of Sciurus' CustomCache for Redis.

Maven Central License Build status Build status Code Quality

General Usage

You need to include Sciurus Cache Redis as dependency and declare Sciurus as an aspect library in the aspectj-maven-plugin:

  1. Include Sciurus Cache Redis as dependency

    <dependency>
        <groupId>io.mcarle</groupId>
        <artifactId>sciurus-cache-redis</artifactId>
        <version>1.0.0</version>
    </dependency>
  2. Include aspectj-maven-plugin and define Sciurus as aspectLibrary

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.11</version>
        <executions>
            <execution>
                <goals>
                    <goal>compile</goal>
                    <goal>test-compile</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <complianceLevel>${maven.compiler.source}</complianceLevel>
            <source>${maven.compiler.source}</source>
            <target>${maven.compiler.target}</target>
            <aspectLibraries>
                <aspectLibrary>
                    <groupId>io.mcarle</groupId>
                    <artifactId>sciurus</artifactId>
                </aspectLibrary>
            </aspectLibraries>
        </configuration>
    </plugin>

How to use?

First, see the Sciurus project to see how to use Sciurus' cache functionality (you will also find a simple example project there).

To register RedisCache to Sciurus, you simply do

Sciurus.registerCache(
    "<name of your cache>",
    new RedisCache(RedisClient.create("redis://localhost:6379/0"))
);

Further inforamtion

This implementation for storing the cached values in Redis is using Java's serialization mechanism. Therefore, you have to make sure that the classes adhere Java's serialization mechanism!

Hint: Sciurus will catch any exception and then simply executes the original method and return the result. The exception is only logged and your application will more or less work, as if there is no cache enabled.

License

Unless explicitly stated otherwise all files in this repository are licensed under the Apache Software License 2.0

Copyright 2019 Marcel Carlé

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
1.0.0