Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #167 from jgordor/master

Option to enable/disable boss_db cache
  • Loading branch information...
commit f4978ea657c3f1a07b531b18119524824653cdc7 2 parents b498cc6 + c9a413a
@evanmiller evanmiller authored
View
1  doc-src/api-config.html
@@ -21,6 +21,7 @@
<li><code>pgsql</code> - PostgreSQL</li>
<li><code>tyrant</code> - Tokyo Tyrant</li>
</ul></li>
+ <li><code>db_cache_enabled</code> - Whether to enable the cache in boss_db. Defaults to false. Requires cache_enable to be set to true.</li>
<li><code>db_shards</code> - A list of proplists with per-shard database configuration. The proplists override the above options, and should contain an additional option:
<ul>
<li><code>db_shard_models</code> - A list of models (atoms) which are stored on the shard.</li>
View
2  skel/boss.config
@@ -60,6 +60,8 @@
%% db_password - The password used for connecting to the database (if
%% needed).
%% db_database - The name of the database to connect to (if needed).
+%% db_cache_enable - Whether to enable the cache in boss_db. Defaults
+%% to false. Requires cache_enable to be set to true.
{db_host, "localhost"},
{db_port, 1978},
View
8 src/boss/boss_web_controller.erl
@@ -69,7 +69,13 @@ init(Config) ->
DBShards = boss_env:get_env(db_shards, []),
CacheEnable = boss_env:get_env(cache_enable, false),
IsMasterNode = boss_env:is_master_node(),
- DBOptions1 = [{adapter, DBAdapter}, {cache_enable, CacheEnable},
+ DBCacheEnable = case {CacheEnable, boss_env:get_env(db_cache_enable, false)} of
+ {true, true} ->
+ true;
+ {_, _} ->
+ false
+ end,
+ DBOptions1 = [{adapter, DBAdapter}, {cache_enable, DBCacheEnable},
{shards, DBShards}, {is_master_node, IsMasterNode}|DBOptions],
boss_db:start(DBOptions1),
Please sign in to comment.
Something went wrong with that request. Please try again.