Sharing memcache with php and nodejs

Is it possible to share javascript objects/php associative arrays with memcache?

Or should I convert the data into a string when sharing them?

Use JSON data fromat to share data between this languages (PHP and JavaScript).

//read from memcache in JS (node.js)
var data = JSON.parse(from_memcache);
//or before write
data = JSON.stringify(data);

//read from memcache in php
$data = json_decode($data_from_memcache);
//or before write
$data = json_encode($data);

This is possible, and the best way to do this is to encode your objects to the JSON format. Memcache is nothing more than a key => value storage, which means everything you store in it is a string (of bytes).