Note that you need to create and get the QueryFactory before you put anything into the cache, otherwise all of the earlier puts will not get indexed.
cache = cacheMgr.getCache(); QueryHelper qh = new QueryHelper(cache, new Properties(), TestRecord.class); QueryFactory qf = new QueryFactory(cache, qh); cache.put(key, value); // repeat this multiple times. // NOW try your query. CacheQuery cq = qf.getBasicQuery("message", searchText); auditLogRecordList = cq.list(); int hits = cq.getResultSize();
As a general rule, if you intend to query stuff in the cache, you should create the QueryHelper and QueryFactory as soon as you create the cache, and before you use the cache for anything.