Version: 5.17
Configure cache
Hazelcast offers a specification-compliant JCache implementation. The Hazelcast JCache implementation is 100% TCK (Technology Compatibility Kit) compliant and therefore passes all specification requirements. You can create and configure JCache using the Cache custom resource.
Configure a cache resource
You can use any of the following configuration options in the Cache resource. For more information, see the API reference.
| Field | Description |
|---|---|
name | Name of the cache that you're creating. If empty, the custom resource (CR) name is used. |
hazelcast | The name of the Hazelcast resource. |
backup | Count of synchronous backups. |
async | Count of asynchronous backups. |
key | Fully qualified class name of the cache key type. |
value | Fully qualified class name of the cache value type. |
persistence | When enabled, the cache data will be persisted. |
in | Format options for storing the data in cache. |
Example configuration
The following Cache custom resource creates a cache configuration for the Hazelcast custom resource that is defined in the hazelcastResourceName field.
Example configuration
yaml
apiVersion: hazelcast.com/v1alpha1
kind: Cache
metadata:
name: cache-sample
spec:
hazelcastResourceName: hazelcast
backupCount: 1
asyncBackupCount: 0
inMemoryFormat: NATIVE
keyType: java.lang.Object
valueType: java.lang.Object
persistenceEnabled: false
After creating the Cache resource, you can check its status:
shell
kubectl get cache cache-sample -o wide
NAME STATUS HAZELCAST-RESOURCE MESSAGE
cache-sample Success hazelcast