[Koha-bugs] [Bug 20930] Validate and cache parsed YAML/JSON type system preferences

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Jan 4 21:49:22 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20930

Michal Denar <black23 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #96108|0                           |1
        is obsolete|                            |
  Attachment #96109|0                           |1
        is obsolete|                            |
  Attachment #96110|0                           |1
        is obsolete|                            |
  Attachment #96111|0                           |1
        is obsolete|                            |
  Attachment #96112|0                           |1
        is obsolete|                            |

--- Comment #24 from Michal Denar <black23 at gmail.com> ---
Created attachment 96817
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96817&action=edit
Bug 20930: Dump and load system preferences of YAML/JSON type

Currently, C4::Context->preference('YAMLpref') returns a string that needs to
be
parsed by any code using the preference.

My suggestion is to return a parsed version instead (a hash/array ref or a
string)
and using the syspref cache with the parsed value. Like this, we could:
- centralize parsing of YAML system preferences
- optimize use of system preference cache by caching the parsed version
instead.
  Parse once and store in cache; no need to re-parse on each call!

We can centralize this functionality into Koha::Config::SysPref->value() (used
by
C4::Context->preference). Use database column systempreferences.type with value
of
"YAML" to trigger this functionality in "value()"-method.

To test:
1. Make sure memcached is available
2. Run tests with caching enabled, e.g.: MEMCACHED_SERVERS=localhost:11211
prove t/db_dependent/Context.t
3. Make sure all tests pass and none were skipped

Signed-off-by: Owen Leonard <oleonard at myacpl.org>

Signed-off-by: Michal Denar <black23 at gmail.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list