Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gravitee-io/gravitee-resource-cache-redis


https://github.com/gravitee-io/gravitee-resource-cache-redis

product-apim security-scan

Last synced: 10 days ago
JSON representation

Awesome Lists containing this project

README

        

= Redis Cache Resource

ifdef::env-github[]
image:https://img.shields.io/static/v1?label=Available%20at&message=Gravitee.io&color=1EC9D2["Gravitee.io", link="https://download.gravitee.io/#graviteeio-apim/plugins/resources/gravitee-resource-cache-redis/"]
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg["License", link="https://github.com/gravitee-io/gravitee-resource-cache-redis/blob/master/LICENSE.txt"]
image:https://img.shields.io/badge/semantic--release-conventional%20commits-e10079?logo=semantic-release["Releases", link="https://github.com/gravitee-io/gravitee-resource-cache-redis/releases"]
image:https://circleci.com/gh/gravitee-io/gravitee-resource-cache-redis.svg?style=svg["CircleCI", link="https://circleci.com/gh/gravitee-io/gravitee-resource-cache-redis"]
image:https://f.hubspotusercontent40.net/hubfs/7600448/gravitee-github-button.jpg["Join the community forum", link="https://community.gravitee.io?utm_source=readme", height=20]
endif::[]

== Description

The Redis cache resource is used to maintain a cache and link it to the API lifecycle.
It means that the cache is initialized when the API is starting and released when API is stopped.

This cache is responsible to store HTTP response from the backend to avoid subsequent calls.

Current implementation of the cache resource is based on https://redis.io/[Redis].

== Compatibility with APIM

|===
| Plugin version | APIM version

| 1.5.0 | 4.0 to 4.4
| 2.0.0 | 4.5 to latest
|===

== Configuration

You can configure the resource with the following options :

|===
|Property |Required |Description |Type |Default

.^|name
^.^|X
|The name of the cache.
^.^|string
^.^|my-redis-cache

.^|releaseCache
^.^|X
| Release the cache when API is stopped? If enabled, the resource will release the cache. If not, you will have to manage it by yourself on your Redis server.
^.^|boolean
^.^|false

.^|maxTotal
^.^|X
|The maximum number of connections that are supported by the pool.
^.^|integer
^.^|8

.^|password
^.^|
|The password of the instance.
^.^|string
^.^|

.^|timeToLiveSeconds
^.^|X
|The maximum number of seconds an element can exist in the cache regardless of use. The element expires at this limit and will no longer be returned from the cache. The default value is 0, which means no timeToLive (TTL) eviction takes place (infinite lifetime).
^.^|integer
^.^|0

.^|timeout
^.^|X
|The timeout parameter specifies the connection timeout and the read/write timeout.
^.^|integer
^.^|2000

.^|timeout
^.^|X
|The timeout parameter specifies the connection timeout and the read/write timeout.
^.^|integer
^.^|2000

.^|useSsl
^.^|X
| Use SSL connections.
^.^|boolean
^.^|true

.^|sentinelMode
^.^|X
|Sentinel provides high availability for Redis. In practical terms this means that using Sentinel you can create a Redis deployment that resists without human intervention certain kinds of failures.
^.^|boolean
^.^|false

|===

=== Standalone configuration

|===
|Property |Required |Description |Type |Default

.^|host
^.^|X
|The host of the instance
^.^|string
^.^|localhost

.^|port
^.^|X
|The port of the instance.
^.^|integer
^.^|6379

|===

[source, json]
.Configuration example
----
{
"name" : "my-redis-cache",
"type" : "cache-redis",
"enabled" : true,
"configuration" : {
"name" : "my-redis-cache",
"releaseCache": false,
"maxTotal" : 8,
"password" : "secret",
"timeToLiveSeconds" : 600,
"timeout" : 2000,
"useSsl" : true,
"sentinelMode" : false,
"standalone": {
"host" : "localhost",
"port" : 6379
}
}
}
----

=== Sentinel configuration

|===
|Property |Required |Description |Type |Default

.^|masterId
^.^|X
|The sentinel master id
^.^|string
^.^|sentinel-master

.^|password
^.^|-
|The sentinel password.
^.^|string
^.^|

.^|nodes
^.^|X
|List of sentinel nodes.
^.^|Array
^.^|

|===

[source, json]
.Configuration example
----
{
"name" : "my-redis-cache",
"type" : "cache-redis",
"enabled" : true,
"configuration" : {
"name" : "my-redis-cache",
"releaseCache": false,
"maxTotal" : 8,
"password" : "secret",
"timeToLiveSeconds" : 600,
"timeout" : 2000,
"useSsl" : true,
"sentinelMode" : true,
"sentinel" : {
"masterId" : "sentinel-master",
"password" : "secret",
"nodes": [
{
"host" : "localhost",
"port" : 26379
},
{
"host" : "localhost",
"port" : 26380
},
{
"host" : "localhost",
"port" : 26381
}
]
}
}
}
----