Retention Policy

The retention policy can be defined in the schema.

For example:

<retention-policies>
<retention-policy type="fact" period="5" unit="WEEK" purge-time-of-day="1200" purge-frequency-period="3600000"/>
<retention-policy type="DevNodeCube/DemoServiceHitCount" period="5" unit="WEEK" purge-time-of-day="1200" purge-frequency-period="86400000"/>
</retention-policies>

where:

  • type="fact" indicates that the purge policy is applied on the facts.
  • period="5" unit="WEEK" indicates that data older than 5 weeks is purged.
  • purge-time-of-day="1200" starts the timer for the purge policy at 12.00 P.M. The first two digits denote the hour and last two digits denote the minutes. Time is represented in a 24-hour notation, in the "hhmm" format. To start the timer on startup, set purge-time-of-day to "-1".
  • purge-frequency-period="3600000" indicates the frequency period after which you the purge policy is triggered. This value is in milliseconds. In this case the purge policy is triggered at 12:00 P.M. and after that at a time interval of "3600000" milliseconds.

The table shows attributes and their equivalent API for the retention policy in the schema:

API for the Retention Policy Element
Attributes API Usage
retention-policy Collection <RetentionPolicy> RTASession.getRetentionPolicies()
type Qualifier getQualifier(). If the qualifier is HIERARCHY, then you can get the type by using String getHierarchyName();
unit TimeUnits.Unit getRetentionUnit()
period long getRetentionPeriod()
purge-time-of-day String getPurgeTimeOfDay()
purge-frequency-period long getPurgeFrequencyPeriod()