scache_move

Description

bool scache_shmove(resource session, string source_path, string target_path)
bool $SCacheConnection->shmove(string source_path, string target_path)

scache_shmove renames source_path into target_path. If source_path contains subtree, subtree is moved in complete into new target_path. Source and target path's can intersect, subtrees can be moved to it's parent and parent can be move to it's descendant. In case target_path already contains data, target is overwritten with source_path's contents.

Unlike scache_move scache_shmove operates on shared keyspace. Move operations are probably most useful on shared keyspace since they allow programmer to construct new complex datastructures on temporary isolated location until moving the constructed structure atomically to shared location used by other clients.

Parameters

session
Session resource returned from scache_open, scache_reset or scache_connect
source_path
Path to be moved.
target
Target path where source is to be moved.

Return values

TRUE on success, FALSE on failure.

In case of failure, error codes resolvable by scache_lasterr is one of below :

Examples

Simple listing :

<?php
$sess = scache_reset('MySess');

scache_shset($sess, 'my/path/somevalue', 'Move me!');
scache_shmove($sess, 'my/path', 'my/path/somevalue/overwritten');
scache_shmove($sess, 'my/path/somevalue/overwritten', 'my');

print_r(scache_shget($sess, 'my/somevalue'));

/* outputs
Move me!
*/
?>