Symfony / PHP - Best way to store single value

♀尐吖头ヾ 提交于 2019-12-10 18:32:15

问题


Assuming that I have an application running on Symfony 3.2 / Doctrine.

Question : What is the best way to store a single value that gonna change over some actions.

First thoughts : Im thinking that creating an Entity that is going to have a single property which will create a table with a single column that is going to have a single value (changing over some actions), is not an optimized solution.

I have also have thought about storing that value on a text file, but im saying that there might be another (better and more optimized) solution to this scenario.

Hint (if it can help) : My value is gonna be a generated PHP uniqid

Thank you in advance.


回答1:


Symfony 3.1 included an interesting Cache component with multiple adapters (Filesystem, APCu, Redis...): http://symfony.com/doc/current/components/cache.html

As Symfony 3.2 the API seems to be confusing but Symfony 3.3 will include a SimpleCache API, way more elegant: http://symfony.com/blog/new-in-symfony-3-3-simple-cache



来源:https://stackoverflow.com/questions/43682239/symfony-php-best-way-to-store-single-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!