title: How to store configs?
body: <p>I am creating a modular system where each module is separated from others.
  I want to store the module configuration data in database, but I don't know best structure for this.</p>
  
  <h2>I have some variants:</h2>
  
  <p><strong>1st:</strong></p>
  
  <pre><code>key_____|______value (primary key is `key`)
  option1 | 1
  option2 | abcd
  option3 | bla-bla-bla
  </code></pre>
  
  <p>I can easy get settings, but if I want to update some settings I'll need to build hard (?) SQL query with CASE:</p>
  
  <pre><code>UPDATE settings SET value = CASE
  WHEN key = option1 THEN 1;
  WHEN key = option2 THEN abcd;
  …
  END
  WHERE key IN (option1, option2, …)
  </code></pre>
  
  <p>If there is a better variant for update many rows in one query (I'll use MySQLi and InnoDB only) this will be great.</p>
  
  <p><strong>2nd:</strong></p>
  
  <pre><code>module_____|_____settings
  news       | a:3:{s:7:"option1";i:1;s:7:"option2";s:4:"abcd";s:7:"option3";s:11:"bla-bla-bla";}
  </code></pre>
  
  <p>This way, I'll serialize an array with settings and put it in database. I want to cache unserialized data in .php files.
  But if I'll have <em>large</em> settings array, my serialized string will be very very big.</p>
  
  <p><strong>3rd:</strong></p>
  
  <pre><code>option1 | option2 | option3
     1    |   abcd  |bla-bla-bla
  </code></pre>
  
  <p>I'll have one column for one option key, but I think that create one table to store one row is unnecessarily.</p>
  
  <hr>
  
  <p>Which variant is the best?
  Can you suggest your own methods to store configs?
  Thank you!</p>