(Quick Reference)

5 Redis Specific Extensions - Reference Documentation

Authors: Graeme Rocher

Version: 5.0.8.RELEASE

5 Redis Specific Extensions

As well as all the regular capabilities offered by the GORM API there are a couple of additional GORM methods that take advantage of some key Redis features. The first one is the random method which will return a random instance of the domain class:

def randomPerson = Person.random()

Implementing a random function in a SQL database is typically quite hard to do in a performant way whilst something like Redis makes it easy.

There is also a pop method that will return and remove a random domain instance in one step:

def randomPerson = Person.pop()