Skip to content

Plug in API Locking

Tomas Machalek edited this page Apr 25, 2016 · 5 revisions

Plug-ins / [locking]

  • type: required
  • interface: plugins.abstract.locking.AbstractLock
  • client-side code: -
  • purpose: a global resource locking mechanism

This plug-in is used to access resources exclusively - currently only as a service for conc_cache. Please note that the implementation of a correct locking mechanism can be quite tricky. If you are not sure about locking issues and plan to use KonText in a high load environment we recommend you to stick with the redis_locking implementation.

❗ Please note that the only plug-in using locking is default_conc_cache. Starting from the version 0.9 KonText offers an alternative caching solution redis_conc_cache which does NOT need locking plug-in. In such cache you can make the plug-in configuration empty:

<plugins>
  ...
  <conc_cache>
    <module>redis_conc_cache</module>
    <cache_dir extension-by="default">/var/local/corpora/cache</cache_dir>
  </conc_cache>
  <locking /> <!-- with redis_conc_cache there is no need for active locking plug-in -->
...
</plugins>

# AbstractLock.__enter__()

Enters a critical section.

# AbstractLock.__exit__(exc_type, exc_val, exc_tb)

Exits a critical section.

Clone this wiki locally