Hi,

I would like to add caching feature to my restful webservices. I am
planning to use the default caching mechanism provided by the symfony.
For that I have changed the cache.yml as given below,

  enabled: on
  with_layout: true
  lifetime: 900
  client_lifetime: 0

And set cache:                  on for prod/test/dev the settings.yml
also.

The caching is working fine. But one issue is, it is caching the data
for separately for different users. For example a routing entry for my
api is

/:servicetype/:ver/:lang/:usertoken/newscategories.:sf_format

The URL for accessing the API is

http://10.1.12.123/hysa/restful.php/news/1/en/user1/newscategories

http://10.1.12.123/hysa/restful.php/news/1/en/user2/newscategories

http://10.1.12.123/hysa/restful.php/news/1/en/user3/newscategories

That is the above url is accessing same content but different users.
But symfony create different caches for each users. But I am aiming to
implement single cache for same content. Is it possible? Hope I
explained my doubt clearly.

Please advise me to implement this scenario.

Regards
Shihab

Hi,

I am trying to incorporate caching for my restful web services written
in php. I am going to use memcache as cache server. I have installed
the memcache. I followed the page http://shikii.net/blog/installing-memca
... windows-7/ for the installation.

After installation I am trying to test my memcache installation is
successful or not. I write the following code for testing

    $memcache = new Memcache; // instantiating memcache extension
class
    $memcache->connect("127.0.0.1",11211) or die ("Could not
connect");

    print_r($memcache);
    echo "<br>";
    try {
  $version = $memcache->getVersion();
echo "Server version: ".$version."<br/>\n";
    } catch (Exception $ex) {
echo $ex->getMessage();
    }

But the getVersion is not returning any value. I think the connection
is successful but I cannot set/get value to memcache. The result of my
code is show below

Memcache Object ( [connection] => Resource id #3 )
Server version:

I am using memcached.exe version = 1.2.6.0 and extension
(php_memcache.dll) version = 2.2.5.0.

And when I tried with error reporting enabled, I got the following
error.

<code>
error_reporting(-1);
ini_set('display_errors', true);
</code>

<code>
Memcache::getversion() [memcache.getversion]: Server 127.0.0.1 (tcp
11211) failed with: Failed reading line from stream (0)
</code>

Can you help me please?

regards
Shihab

Reply via email to