Lazy Vars

Component ID

1509678

Component name

Lazy Vars

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

979

Component created

Component changed

Component body

Lazy Vars is a simple utility module meant to help development on other modules.
It helps store and retrieve arbitrary persistent variables from the database. It is similar to the Core 'variable' system except that it loads the variables on demand and doesn't load them unnecessarily.

It provides a simple API for the common get, set and delete operations

LazyVars::set('my_module_settings', array(1, 2, 3));
$settings = LazyVars::get('my_module_settings', NULL);
LazyVars::del('my_module_settings');

and it also provides an interface so that other modules can implement their own storage back-ends.

interface LazyVarsInterface {
  public static function set($name, $var, $cache = FALSE);
  public static function get($name, $default = NULL, $cache = TRUE);
  public static function del($name);
}