Engineering
Releases
News and Events

Announcing GORM for Redis

One of the major movements inspired by the rise of the cloud platform is the growing interest in alternative storage techniques to traditional relational databases. One such storage mechanism is Redis, a high performance key/value store that is playing an important part in future cloud infrastructure.

There has been a lot of interest in Redis within the Grails community and hot on the heels of the Redis 2.0.0 release we are pleased to announce the availability of GORM for Redis Milestone 1.

What is GORM for Redis? Quite simply it allows Grails developers used to the convenience of features such as dynamic finders, criteria and named queries to take advantage of Redis as their underlying store instead of Hibernate.

Once you have Redis up and running you can install GORM for Redis from the Grails command line:

grails install-plugin redis

If you uninstall the Hibernate plugin then all domain classes in grails-app/domain will become Redis entities instead, otherwise you can specify an individual entity as persistable with Redis using:

static mapWith = "redis"

Once you have your Redis domain classes ready you can continue to use the regular GORM API methods such as save(), delete(), dynamic finders etc.

A lower-level API is also included if you want to build your own indices:

def theSimpsons = Person.findAllByLastName("Simpson")
def list = redis.list("the.simpsons")
theSimpsons.each { list << it.id }

And then query the indices:

def theSimpsons = redis.entities(Person, "the.simpsons")
theSimpsons.each {
    println it.firstName
}

See the full documentation for further information on working with the lower level API and other features. There is also a sample application available to download.

The Redis plugin itself is built on the Inconsequential codebase which is designed as an abstraction above NoSQL stores. We also have in-progress support for other alternative stores such as Cassandra and JCR.

The project is open source and we are interested in collaborating with the NoSQL community to build out similar support as that found in GORM for Redis. There is a GORM TCK which you can run against an implementation to test compatibility which we continue to extend to cover as many features of GORM as possible.

If you’re interested in helping us on our quest give us a shout on the Inconsequential mailing list.

This is a milestone release, so we’re interested in hearing your feedback as we head closer to milestone 2 and the inevitable final release.

Enjoy!

comments powered by Disqus