(Quick Reference)

4 Querying - Reference Documentation

Authors: Graeme Rocher

Version: 5.0.8.RELEASE

Table of Contents

4 Querying

As mentioned in the previous section you must specify the properties that can be queried with index:true in your mapping block. Once a property can be queried upon then there are several ways to do it including:

These queries operate in largely the same way as they do with GORM for Hibernate. Note, however, that each criterion used in a query results in querying another index and although GORM for Redis caches query results you should be careful not to use too many criteria as it will impact query performance.

A good way to debug your query performance is to go to your Redis distribution and type the following in a command or terminal window:

$ ./redis-cli
$ MONITOR

The MONITOR command will allow you to monitor the commands that the currently running Redis server is receiving and responding to. Great for debugging!

4.1 Query Limitations

There are some limitations with queries in Redis that you should be aware of, after all Redis is not a relational database. Below are some of the known limitations:
  • Sorting can only be done on dates and numbers and not String values / complex types
  • Querying associations via nested criteria is not currently supported