modelsMetadata cannot be reset

I set modelsMetadata as follow in DI:

$diContainer->set('modelsMetadata', function () use ($config) {
    return new \Phalcon\Mvc\Model\MetaData\Redis([
        'host' => $config['redis']['host'],
        'port' => $config['redis']['port'],
        'lifetime' => 315360000,
    ]);
});

And I reset modelsMetadata as follow:

 DI::getDefault()->get('modelsMetadata')->reset();

But nothing happens.

I am using phalcon2.0.6.



30.0k

Hi,

I think that you are using redis metadata adapter from the incubator (https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Mvc/Model/MetaData). I've never used this feature. But it seems to me that you didn't declare correctly the service in the DI. (looks like you did not connect to the redis server)

$di->set('modelsMetadata', function ()
{
    $redis = new Redis();
    $redis->connect('localhost', 6379);

    return new \Phalcon\Mvc\Model\MetaData\Redis(array(
        'redis' => $redis,
    ));
});


1.7k

I'm using Phalcon 2.0.6 which has implemented redis metadata adapter.

Hi,

I think that you are using redis metadata adapter from the incubator (https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Mvc/Model/MetaData). I've never used this feature. But it seems to me that you didn't declare correctly the service in the DI. (looks like you did not connect to the redis server)

```php

$di->set('modelsMetadata', function () { $redis = new Redis(); $redis->connect('localhost', 6379);

return new \Phalcon\Mvc\Model\MetaData\Redis(array( 'redis' => $redis, )); });

```



30.0k

ok, I didn't know that.

but what about your modelsMetaData service configuration ?

I'm using Phalcon 2.0.6 which has implemented redis metadata adapter.

Hi,

I think that you are using redis metadata adapter from the incubator (https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Mvc/Model/MetaData). I've never used this feature. But it seems to me that you didn't declare correctly the service in the DI. (looks like you did not connect to the redis server)

```php

$di->set('modelsMetadata', function () { $redis = new Redis(); $redis->connect('localhost', 6379);

return new \Phalcon\Mvc\Model\MetaData\Redis(array( 'redis' => $redis, )); });

```



1.7k
 $diContainer->set('modelsMetadata', function () use ($config) {
    return new \Phalcon\Mvc\Model\MetaData\Redis([
        'host' => $config['redis']['host'],
        'port' => $config['redis']['port'],
        'lifetime' => 315360000,
    ]);
});

ok, I didn't know that.

but what about your modelsMetaData service configuration ?

I'm using Phalcon 2.0.6 which has implemented redis metadata adapter.

Hi,

I think that you are using redis metadata adapter from the incubator (https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Mvc/Model/MetaData). I've never used this feature. But it seems to me that you didn't declare correctly the service in the DI. (looks like you did not connect to the redis server)

```php

$di->set('modelsMetadata', function () { $redis = new Redis(); $redis->connect('localhost', 6379);

return new \Phalcon\Mvc\Model\MetaData\Redis(array( 'redis' => $redis, )); });

```



30.0k

Ok, I've had a look at https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model/metadata/redis.zep and your config seems to be correct.

Does otherwise the redis metadata adapter work correctly ( <=> function read() and write() ) ?