Managing cached data with DeleteStoredData

The MIP SDK Protection engine caches protection licenses and service discovery data locally to improve performance and reduce network calls. Over time, this cache can grow, especially in applications that process large volumes of protected content. Starting in MIP SDK 1.18, the DeleteStoredData() method on ProtectionEngine provides a way to remove cached data programmatically.

Overview

The DeleteStoredData() API is available on ProtectionEngine and provides two overloads:

  • Delete all or expired data: Pass a boolean to delete all cached data or only expired entries.
  • Delete data before a time point: Pass a specific time point to remove all data cached before that point.

This is especially useful for:

  • Server or daemon applications that process large volumes of protected content and need to manage disk usage.
  • Compliance scenarios where cached license data must be purged periodically.
  • Long-running applications that accumulate cached data over time.

C++ example

#include "mip/protection/protection_engine.h"

// Delete only expired cached data (default behavior)
protectionEngine->DeleteStoredData();

// Delete all cached data
protectionEngine->DeleteStoredData(true);

// Delete cached data older than 30 days
auto thirtyDaysAgo = std::chrono::system_clock::now() - std::chrono::hours(24 * 30);
protectionEngine->DeleteStoredData(thirtyDaysAgo);

C# (.NET) example

// Delete only expired cached data
protectionEngine.DeleteStoredData();

// Delete all cached data
protectionEngine.DeleteStoredData(deleteAllData: true);

// Delete cached data older than 30 days
var thirtyDaysAgo = DateTime.UtcNow.AddDays(-30);
protectionEngine.DeleteStoredData(thirtyDaysAgo);

Java example

// Delete only expired cached data
protectionEngine.deleteStoredData();

// Delete all cached data
protectionEngine.deleteStoredData(true);

// Delete cached data older than 30 days
ZonedDateTime thirtyDaysAgo = ZonedDateTime.now().minusDays(30);
protectionEngine.deleteStoredData(thirtyDaysAgo);