Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1021911 // GazelleContextCache

JavaX fragment (include)

sclass GazelleContextCache {
  transient Lock lock = lock();
  transient GazelleEvalContext cachedCtx;
  
  GazelleEvalContext get() {
    lock lock;
    GazelleEvalContext ctx = cachedCtx;
    if (ctx == null) {
      GazelleEvalContext _cachedCtx = dm_gazelle_stdEvalContext(dm_gazelle_allRulesWithComment("discord"));
      cachedCtx = _cachedCtx;
      ctx = gazelle_cloneCtx(_cachedCtx);
    }
    ret ctx;
  }

  AutoCloseable listenToMessages() {
    ret vmBus_onMessages(r { cachedCtx = null },
      'gazelleRulesChanged, 'gazelleFeedbackChanged);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021911
Snippet name: GazelleContextCache
Eternal ID of this version: #1021911/2
Text MD5: 0b48f276de6c062ed1bcb337189837f8
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-03 15:26:25
Source code size: 581 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 256 / 727
Version history: 1 change(s)
Referenced in: #1022074 - GazelleContextCache_v2 - keeps loaded rules & updates them individually
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)