Child pages
  • Getting Started With Ehcache Search API For Clustered Caches

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin


Ehcache Search is a powerful search API for querying clustered caches in a Terracotta cluster. Designed to be easy to integrate with existing projects, the Ehcache Search API can be implemented with configuration or programmatically. The following is an example snipped from an Ehcache configuration file:

Code Block
xml
xml
bgColor#FFFFFF
borderStylesolidxml
  <cache name="myCache" maxElementsInMemory="0" eternal="true"
    overflowToDisk="false">
    <searchable>
      <searchAttribute name="age" />
      <searchAttribute name="first_name" expression="value.getFirstName()" />
      <searchAttribute name="last_name" expression="value.getLastName()" />
      <searchAttribute name="zip_code" expression="value.getZipCode()" />
    </searchable>
    <terracotta />
  </cache>

...

Searches occur on indexes held by the Terracotta server. By default, index files are stored in /index under the server's data directory. However, you can specify a different path using the <index> element:

Code Block
xml
xml
bgColor#FFFFFF
borderStylesolidxml
...
<server>
  <data>%(user.home)/terracotta/server-data</data>
  <index>%(user.home)/terracotta/index</index>
  <logs>%(user.home)/terracotta/server-logs</logs>
  <statistics>%(user.home)/terracotta/server-statistics</statistics>
...
</server>
...

...