Configuring 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.
Configuring 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 of the cache configuration that you’re creating. If empty, the custom resource (CR) name is used. |
|
Defines the name of the Hazelcast resource for which the cache configuration is created. |
|
Count of synchronous backups. |
|
Count of asynchronous backups. |
|
Fully qualified class name of the cache key type. |
|
Fully qualified class name of the cache value type. |
|
When enabled, the cache data will be persisted. |
|
Represents the 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.
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, use the following command to check its status:
kubectl get cache cache-sample -o wide
NAME STATUS MESSAGE
cache-sample Success