scache_move
Description
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
Return values
TRUE on success, FALSE on failure.
In case of failure, error codes resolvable by scache_lasterr is one of below :
- SCERR_NOT_EXIST Path given does not exist.
- SCERR_NO_SESSION Connected session does not exist or has been expired. Connection is not valid any more.
- SCERR_NOT_CONNECTED Connection to backend is broken and cannot be reconnected.
- SCERR_PROTOCOL Internal protocol error has occurred when communicating to backend. This indicates something is severely broken.
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! */ ?>