dongliu5475 2016-03-03 08:20
浏览 50
已采纳

Redis作为CakePHP 3中的NoSQL键/值数据库

I'am wondering what is the best way to use Redis NoSQL Database in CakePHP not for Caching but as regular Key/Value Store?

There is a Plugin for Redis 2.4.2 or higher, but the Plugin does not work with CakePHP 3.x: Redis CakePHP 2.4.2 Plugin

What is the best way to use Redis in CakePHP 3 as regular Key/Value Database? How costly is it to upgrade the CakePHP 2.4.2 Redis-Plugin to a CakePHP 3.x Plugin. Is the migration of the Plugin the best way or is it better to create a new Datasource? (The current Redis-Plugin extends the Datasource-class.)

  • 写回答

1条回答 默认 最新

  • douran7929 2016-03-03 10:00
    关注

    Take a close look at what that datasource does, it's pretty much just a proxy to a Redis class instance, other than that it only handles connecting and disconnecting.

    So besides having auto connect/disconnect functionality, there is pretty much no point in implementing such a datasource, and you could also just use Redis directly instead.

    https://github.com/phpredis/phpredis#classes-and-methods

    If you'd wanted to use it as a datasource, ie have it accessible via the connection manager, then you'll have to implement \Cake\Datasource\ConnectionInterface.

    If you are looking for a datasource that acts as an ORM, that's a complete different story, and a rather complex task, see for example the CakePHP ElasticSearch Datasource plugin.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?