1:- module(bitrix24_provider_memory, [
    2          reset/0,
    3          set_config/2,
    4          set_default_context/1,
    5          get_config/2,
    6          load_context/2,
    7          save_context/2,
    8          delete_context/1,
    9          default_context/1
   10      ]).   11
   12:- dynamic stored_config/2.   13:- dynamic stored_context/2.   14:- dynamic stored_default_context/1.   15
   16reset :-
   17    retractall(stored_config(_, _)),
   18    retractall(stored_context(_, _)),
   19    retractall(stored_default_context(_)).
   20
   21set_config(Key, Value) :-
   22    retractall(stored_config(Key, _)),
   23    assertz(stored_config(Key, Value)).
   24
   25set_default_context(ContextRef) :-
   26    retractall(stored_default_context(_)),
   27    assertz(stored_default_context(ContextRef)).
   28
   29get_config(Key, Value) :-
   30    stored_config(Key, Value).
   31
   32load_context(ContextRef, Context) :-
   33    stored_context(ContextRef, Context).
   34
   35save_context(ContextRef, Context) :-
   36    retractall(stored_context(ContextRef, _)),
   37    assertz(stored_context(ContextRef, Context)).
   38
   39delete_context(ContextRef) :-
   40    retractall(stored_context(ContextRef, _)).
   41
   42default_context(ContextRef) :-
   43    stored_default_context(ContextRef)