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.

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

报告相同问题?

悬赏问题

  • ¥15 CSS通配符清除内外边距为什么可以覆盖默认样式?
  • ¥15 SPSS分类模型实训题步骤
  • ¥15 求解决扩散模型代码问题
  • ¥15 工创大赛太阳能电动车项目零基础要学什么
  • ¥20 limma多组间分析最终p值只有一个
  • ¥15 nopCommerce开发问题
  • ¥15 torch.multiprocessing.spawn.ProcessExitedException: process 1 terminated with signal SIGKILL
  • ¥15 QuartusⅡ15.0编译项目后,output_files中的.jdi、.sld、.sof不更新怎么解决
  • ¥15 pycharm输出和导师的一样,但是标红
  • ¥15 想问问富文本拿到的html怎么转成docx的