Dexterex
(Edu Utn)
January 31, 2011, 9:25pm
1
Hi all!
This is my first Topic ( I started using yii last week )
Sorry for make 3 questions in only one Topic but i think it will be easy for you.
ROUTE
Hou can i change from :
www.foo.com/?r=site/test
To
www.foo.com/site/test
POST
Is there a way to make a http ‘post’ to an action?
I’m requesting via POST to
www.foo.com/?r=site/test
and get an error.
MEMCACHE
I’m using memcache, i have all configurated and i am using with php like this:
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$CardsCubsObj = $memcache->get('cardinals_cubs');
but i want to use it via Yii, I’ve configurated main.php properly. How can I invoque “CMemCache”?
I want to do something like:
$cache = new CMemCache // with all configurated servers
$cache->set(....)
Thank in advance.
Eduardo Leiva
Dexterex
(Edu Utn)
February 1, 2011, 2:42am
3
route: perfect!
post: Always return the default page configurated in config.php.
( i’m using SOAPUi to test )
memcache: I am already using memcache (is working with actual code), but when i try:
$value=Yii::app()->cache->get("foo");
get:
include(Memcached.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory
C:\Users\eleiva\Development\eclipse\wrk_sts_1\Frases\lib\yii-1.1.6.r2877\framework\YiiBase.php(395)
my config file:
'components'=>array(
'cache'=>array(
'class'=>'CMemCache',
'useMemcached'=>true,
'servers'=>array(
array(
'host'=>'xxx:xxx',
'port'=>11211,
'weight'=>60,
),
),
)
thanks!
Hi,
It seems that when you set its useMemcached= true, Yii will return an instance of MemCached ( http://www.yiiframework.com/doc/api/1.1/CMemCache#getMemCache-detail )
public function getMemCache()
{
if($this->_cache!==null)
return $this->_cache;
else
return $this->_cache=$this->useMemcached ? new Memcached : new Memcache;
}
That means, that you need to include the file where Memcached is in order to create an instance at any place in the code. The __autoload is failing to include the file… this is the actual error.
About the other problem, have you tried including index.php in your request? www.foo.com/index.php?r=site/test