webCOMAND

repo::uninit()

Uninitialize a repository connection by releasing all memory used by the various caches, including most significantly the object cache.

Repository connections within a PHP thread are persistent, so memory allocated for various caches is not released unless uninit() is called.  If it is not called, subsequent connections to the repository will reuse the cache from the previous connection to optimize performance.

Prototype

string uninit()

Return

Nothing is returned.

Example

// Remove Files from their folders 1000 at a time until none are left.
// Release repository memory and reconnect every 1000 Files processed.
do {
    $repo = comand::repo([], true);
    $files = $repo->get("FROM File+ WHERE !ISNULL(Folders) LIMIT 1000");
    foreach($files as $file) {
        $file->Folders = []; // remove File from all folders
        $file->approve();
    }
    $repo->uninit();
} while(count($files)>0);