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 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作