« Back to Product

Documentation

IPS_SetMediaCached

 bool IPS_SetMediaCached (int $MediaID, bool $CacheActivated) 

Parameters

MediaID

ID of the media object

CacheActivated

TRUE, if the media object should only be modified in the cache, otherwise FALSE

Returns

If the function succeeds, it returns TRUE, otherwise FALSE.

Description

The function activates or deactivates the caching for a media object with the ID MediaID. If activated, the media object is only modified within the internal memory when the functions IPS_SetMediaContent or IPS_GetMediaContent are used. When IP-Symcon shuts down, the media object is automatically written to the disk and thus becomes persistent. When caching is deactivated, the content held in memory is first written to the file of the media object, so no changes are lost.

Warning

This function can be used to decrease the burden to SSDs or flash memories.

Example

$MediaID = IPS_CreateMedia(MEDIATYPE_IMAGE); // Create image within the media pool
IPS_SetMediaCached($MediaID, true);
// Caching is activated for the media object
// The object is read from the hard disk on the first access
// and is only processed in the internal memory afterwards.
Any questions?