Disposal Policies
A disposal policy defines criteria for objects of a specified class to be automatically deleted by a Content Engine background task. The background task repeatedly sweeps over the database table that stores objects of the specified class and removes the objects that satisfy the policy criteria. A disposal policy keeps count of sweep results, including completed iterations and objects that are examined, processed, and failed. For server installations configured for retention, a disposal policy can identify objects with a retention date in the past and remove them from the database.
A disposal policy is represented by a CmDisposalPolicy
object. You create a CmDisposalPolicy object with a factory method, set the
disposal criteria with the FilterExpression property, and set the class instances to be disposed
with the SweepTarget property. You can also set the start and end times for the disposal policy to
be in effect.
When you create a CmDisposalPolicy object, the
server automatically creates, if necessary, the following objects
that are required for policy-based processing:
- CmPolicyControlledSweep represents the background service that is controlled by a sweep
policy, such as a disposal policy. You can configure a
CmPolicyControlledSweepobject with timeslots, providing extra control over when the sweep runs.The same
CmPolicyControlledSweepobject is used for multiple sweep policies that target the same database table. TheCmPolicyControlledSweepobject evaluates and applies the multiple policies when the database table is swept.By using the SweepSubscribers property of the policy controlled sweep, you can retrieve the sweep policies that subscribe to the policy controlled sweep, and then iterate the policies to identify the disposal policies.
- CmSweepPolicyRelationship defines an association between a policy controlled sweep and a
sweep policy. By using the SweepSubscriptions property of the sweep policy, you can retrieve the
CmSweepPolicyRelationshipobject. With theCmSweepPolicyRelationshipobject, you can retrieve the policy controlled sweep that is associated with the disposal policy.
CmPolicyControlledSweep and CmSweepPolicyRelationship objects
cannot be deleted manually. When you delete a CmDisposalPolicy object,
the dependent CmSweepPolicyRelationship object is
deleted automatically by the system. If the deleted CmDisposalPolicy object
is the last sweep policy that is subscribed to the policy controlled
sweep, then the CmPolicyControlledSweep is deleted as
well.
A CmDisposalPolicy object also includes properties to enable generation of
failure result records and to retrieve them. Each failure result record identifies a swept object
for which the failure occurred, and describes the reason for the failure. For more information, see
CmSweepResult.
For code examples, see Working with Disposal Policies.