Search code examples
snappydata

Does EXPIRE option in SnappyData DDL Syntax do an actual delete?


In this DDL syntax, does EXPIRE mean, SnappyData literally deletes the record(s) after this amount of time? Or, just expires it from local cache/memory, where it can be retrieved again from disk later?

CREATE TABLE [IF NOT EXISTS] table_name
   (
  COLUMN_DEFININTION
   )
USING 'row | column'
OPTIONS (
COLOCATE_WITH 'table_name',  // Default none
PARTITION_BY 'PRIMARY KEY | column name', // If not specified it will be a replicated table.
BUCKETS  'NumPartitions', // Default 113
REDUNDANCY        '1' ,
RECOVER_DELAY     '-1',
MAX_PART_SIZE      '50',
EVICTION_BY ‘LRUMEMSIZE 200 | LRUCOUNT 200 | LRUHEAPPERCENT,
PERSISTENT  ‘DISKSTORE_NAME ASYNCHRONOUS | SYNCHRONOUS’, //empty string will map to default diskstore
OFFHEAP ‘true | false’ ,
**EXPIRE ‘TIMETOLIVE in seconds'**,
)

Solution

  • EXPIRE causes the records to be deleted permanently after specified TIMETOLIVE. If you want to only remove the entry from MEMORY and keep them on disk you would want to use EVICTION properties. For more on EVICTION please see

    http://rowstore.docs.snappydata.io/docs/developers_guide/topics/cache/cache.html