Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt

When building dataloader plugins it can be useful to be able to store key-value pairs long term or for storage or caching purposes. For this purpose, two stores are made available to the DataSource Class.

Table of Contents

Table of Contents

Features

This API provides you with:

...

The following methods are available on both stores:

MethodDescription
get(key, default=None)Return the value for the given key or, if the key does not exist, the provided default.
put(key, value)Store the given value for the key.
iteritems()Iterate over all key/value pairs in the store. Note: not supported for filesystem backend
clear()Remove all stored key/value pairs.
del

Remove the given key. Example:

del self.key_value_cache[key]

Backend configuration

If you are running the Squirro data loader in the command line mode, you can configure the below mentioned command line options to the squirro_data_load tool to control the implementation of the key value stores. The implementation backend (store_backend) defaults to filesystem in the command line mode.

...