Book Image

Getting Started with Hazelcast

By : Matthew Johns
Book Image

Getting Started with Hazelcast

By: Matthew Johns

Overview of this book

Table of Contents (18 chapters)
Getting Started with Hazelcast
About the Author
About the Reviewers

Searching and indexing

In moving towards creating clean key/value-based storage, we may find that we have lost some of the extra searching capabilities that traditional databases offer. Mainly that we now can't find records within a dataset without knowing the primary key to that entry. However, fear not, as Hazelcast provides similar capabilities for searching its maps by predefined indexes. These can be either ordered (ascending) or unordered, depending on our particular data needs. But be aware that indexing doesn't come for free; the internal lookup table used to provide the quick searching on reads is maintained as we make changes to the map; this will add latency to every write operation to that namespace.

So firstly, let's create a new plain old Java object (POJO) to represent a city.


public class City implements Serializable {
  private String name;
  private String country;
  private int population;

  public City(String name, String country, int population...