Symfony / PHP - 存储单一值的最佳方式 [英] Symfony / PHP - Best way to store single value
问题描述
问题:
什么是最好的方式存储一些值将会改变某些操作。
第一个想法:我认为创建一个将具有单个属性的实体这将创建一个具有单个列的表,将具有单个值(更改某些操作),不是优化的解决方案。
我也有想法关于将该值存储在文本文件上,但是我说可能会有另一个(更好和更优化)的解决方案。
提示(如果可以帮助):我的价值将是生成的PHP uniqid
提前谢谢。
Symfony 3.1包含有趣的缓存组件与mu lti适配器(Filesystem,APCu,Redis ...): http://symfony.com /doc/current/components/cache.html
作为Symfony 3.2,API似乎令人困惑,但Symfony 3.3将包含一个SimpleCache API,方式更加优雅: http://symfony.com/blog/new-in -symfony-3-3-simple-cache
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.
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
这篇关于Symfony / PHP - 存储单一值的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!