N
N
nepster-web2014-01-07 22:47:08
Yii
nepster-web, 2014-01-07 22:47:08

Yii cache key access via url?

So you need to implement the following:
Yii writes data to the cache, and then the data should be available at:
site.ru/_stat/cache key
We have nginx as a server, os: centos.
So:

if(!Yii::app()->cache->set($GameProposalModel->proposal_id, 'renderTable('.json_encode($toCache).')'))

I write the data to the cache, for example the key will be 30 ($GameProposalModel->proposal_id = 30)
Next, go to nginx:
location /_stat {
        set            $memcached_key "$uri?$args";
        memcached_pass 127.0.0.1:11211;
        error_page     404 502 504 = @fallback;
        add_header Content-Type "text/html; charset=utf-8";	
    }


    location @fallback {

        proxy_pass  http://localhost:9000;
    }

Further, I figured that I should get my cache data from the site.ru/_stat/30 link.
But I only get 502 Bad Gateway
Example from
nginx.org/ru/docs/http/ngx_http_memcached_module.html Can
you please tell me what is the problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2014-01-08
Protko @Fesor

and since when is access to memcache going via http? there is a binary protocol.

E
Eugene, 2014-01-08
@Nc_Soft

see nginx error logs

A
Alexander Melekhovets, 2014-01-08
@Blast

You put data into the cache by the "30" key, and retrieve it by "$uri?$args" (site.ru/_stat/30). That is, you need to pull out 30 from uri and put it in $memcached_key.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question