Enabling and configuring caching
Using CQL to enable or disable caching.
Use CQL to enable or disable caching by configuring the caching table property. Set parameters in the
cassandra.yaml file to configure global caching
properties:
- Partition key cache size
- Row cache size
- How often Cassandra saves partition key caches to disk
- How often Cassandra saves row caches to disk
Set the caching property using CREATE TABLE or ALTER TABLE. For example, configuring the row_cache_size_in_mb determines how much space in memory Cassandra allocates to store rows from the most frequently read partitions of the table.
The location of the cassandra.yaml file depends on the type of
installation:
Package installations | /etc/cassandra/cassandra.yaml |
Tarball installations | install_location/resources/cassandra/conf/cassandra.yaml |
Procedure
Set the table caching property that configures the partition key cache and the
row cache.
CREATE TABLE users (
userid text PRIMARY KEY,
first_name text,
last_name text,
)
WITH caching = { 'keys' : 'NONE', 'rows_per_partition' : '120' };