PHP: optimum configuration storage?

后端 未结 3 1949
别跟我提以往
别跟我提以往 2021-01-21 05:29

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

I want to find the best deployment method for these configurations, knowing that

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-21 06:26

    How about in a database?

    With a schema like this:

    | key | value |
    

    You could have data like this:

    | currency | pound |
    | timezone | GMT   |
    

    It also means you can query it like this:

    SELECT * FROM options WHERE key = 'timezone'
    

    Or even return many options:

    SELECT * FROM options WHERE key IN ('timezone','currency')
    

    This can be in any kind of database, not least an SQLite database. If you're using a language such as PHP you can use ADOdb for database abstraction so your application is portable between different database types, just a thought if you were concerned about being tied down to one database.

提交回复
热议问题