PHP:最佳配置存储? [英] PHP: optimum configuration storage?

查看:133
本文介绍了PHP:最佳配置存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序通过很多键/值进行配置(比如说30.000)

My application gets configured via a lot of key/values (let's say 30.000 for instance)

我想找到这些配置的最佳部署方法,我想避免使用DEFINE来允许运行时重新配置。

I want to find the best deployment method for these configurations, knowing that I want to avoid DEFINEs to allow for runtime re-configuration.

我想到了


  • 通过php文件将它们预先编译成数组

  • 将它们预编译到tmpfs sqlite数据库中

  • into a memcached db

我对


  • 这些配置的最佳随机访问时间(内存不是问题)?

  • 最好的结构化访问时间,如果我可以将这些配置分为,..)

感谢
Jerome

Thanks Jerome

推荐答案

好吧,如果内存不是一个问题,只是序列化一个数组到一个文件。没有比这更快的解决方案。你没有SQLite的I / O和库开销,你没有memcached的网络开销。

Well, if memory isn't an issue, just serialize an array to a file. There is absolutely no faster solution than this. You don't have the I/O and library overhead of SQLite, and you don't have the network overhead of memcached.

但是请记住,内存必须真的不是问题。您将一次将整个30,000个元素数组加载到内存中,而不是使用数据库,您可以根据需要加载它们。

But keep in mind, memory must really not be an issue. You'd be loading the entire 30,000 element array into memory at once, as opposed to using a database, where you could load them on an as-needed basis.

结构的设置,你可以把每个在自己的文件。

To structure the settings, you could put each in its own file.

但真的,你应该使用数据库。这就是他们在那里。我真的怀疑为什么你需要担心30k的设置。你可能想重新考虑你的应用程序设计。

But really, you should be using a database. That's what they're there for. I really question why you would need to worry about 30k settings..you might want to reconsider your application design.

这篇关于PHP:最佳配置存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆