////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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

https://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.
////

The Grails Redis plugin provides access to https://redis.io[Redis] and a number of utilities (a service, taglib, and memoization annotations) for using Redis as a flexible, high-performance cache within a Grails application.

==== What is Redis?

Redis is often described as a "collection of data structures exposed over the network". It is an https://redis.io/topics/benchmarks[insanely fast] key/value store, in some ways similar to https://memcached.org/[Memcached], but the values it stores are not just dumb blobs of data — they are data structures such as https://redis.io/commands#string[strings], https://redis.io/commands#list[lists], https://redis.io/commands#hash[hash maps], https://redis.io/commands#set[sets], and https://redis.io/commands#sorted_set[sorted sets]. Redis can also act as a lightweight pub/sub or message-queueing system.

Redis is used in production by a https://redis.io/topics/whos-using-redis[number of very popular] websites. It is commonly used as a caching layer, but because it provides network-available data structures it is very flexible and able to solve all kinds of problems. The creator of Redis, Salvatore Sanfilippo, has a nice post on http://antirez.com/post/take-advantage-of-redis-adding-it-to-your-stack.html[taking advantage of Redis by adding it to your stack]. With the Grails Redis plugin, adding Redis to your Grails application is very easy.

For a gentle start there is an http://naleid.com/blog/2010/12/28/intro-to-using-redis-with-groovy/[introduction to Redis using Groovy] that shows how to install Redis and use some basic Groovy commands, as well as a http://naleid.com/blog/2011/06/27/redis-groovy-and-grails-presentation-at-gr8conf-2011-and-gum/[presentation given at gr8conf 2011]. The official https://redis.io[Redis documentation] is excellent and includes a comprehensive https://redis.io/commands[list of Redis commands]; each command page also has an embedded REPL that lets you test the command against a live Redis server.

==== What is Jedis?

The plugin connects to Redis using https://github.com/redis/jedis[Jedis], a fast and actively-maintained Java client. One of the nice things about Jedis is that it does not munge the Redis command names but follows them as closely as possible. This means that for almost all commands the https://redis.io/commands[Redis command] documentation can also be used to understand how to use the Jedis connection objects — you do not need to translate the Redis documentation into Jedis commands.
