1 | static Cache<MultiMap<S, WebNode>> cachedNodeIndex2_cache = new Cache(f cachedNodeIndex2_make); |
2 | static bool cachedNodeIndex_autoMake = true; |
3 | sbool cachedNodeIndex2_monitorCircleEditor; |
4 | static bool cachedNodeIndex2_first = true; |
5 | static FileStatus cachedNodeIndex2_status; |
6 | |
7 | please include function postSoftwareMadeWeb. |
8 | |
9 | static MultiMap<S, WebNode> cachedNodeIndex2() { |
10 | if (cachedNodeIndex2_first) { |
11 | cachedNodeIndex2_first = false; |
12 | onWebsChanged(f cachedNodeIndex2_clear); |
13 | onTransientWebAdded_do(f cachedNodeIndex2_onNewWeb); |
14 | onTransientWebRemoved_do(f cachedNodeIndex2_onWebRemoved); |
15 | setAdd(postSoftwareMadeWeb_onNewWeb, f cachedNodeIndex2_onNewWeb); |
16 | } |
17 | |
18 | if (cachedNodeIndex2_monitorCircleEditor) { |
19 | FileStatus status = conceptsFileStatus(circlesEditorDBID()); |
20 | if (neq(cachedNodeIndex2_status, status)) { |
21 | cachedNodeIndex2_status = status; |
22 | cachedNodeIndex2_cache.clear(); |
23 | } |
24 | } |
25 | |
26 | ret cachedNodeIndex2_cache!; |
27 | } |
28 | |
29 | static void cachedNodeIndex2_clear() { |
30 | cachedNodeIndex2_cache.clear(); |
31 | } |
32 | |
33 | sbool cachedNodeIndex2_onNewWeb(Web web, O[] params) { |
34 | ret cachedNodeIndex2_onNewWeb(web); |
35 | } |
36 | |
37 | sbool cachedNodeIndex2_onNewWeb(Web web) { |
38 | if (!cachedNodeIndex_autoMake) false; |
39 | lock cachedNodeIndex2_cache.lock; |
40 | //print("Incremental update"); |
41 | ai_addWebToIndex(cachedNodeIndex2_cache!, web); |
42 | cachedNodeIndex2_cache.changeCount++; |
43 | false; // don't trigger full update |
44 | } |
45 | |
46 | svoid cachedNodeIndex2_onWebRemoved(Web web) { |
47 | if (!cachedNodeIndex_autoMake) ret; |
48 | lock cachedNodeIndex2_cache.lock; |
49 | print("Incremental removal"); |
50 | ai_removeWebFromIndex(cachedNodeIndex2_cache!, web); |
51 | cachedNodeIndex2_cache.changeCount++; |
52 | } |
53 | |
54 | static long cachedNodeIndex_changeCount() { |
55 | ret cachedNodeIndex2_cache.changeCount; |
56 | } |
57 | |
58 | static MultiMap<S, WebNode> cachedNodeIndex2_make() { |
59 | if (cachedNodeIndex_autoMake) { |
60 | print("Making index"); |
61 | ret dwlw_fullNodeIndex_ci(); |
62 | } else { |
63 | //print("Skipping making index"); |
64 | ret ai_emptyWebIndex(); |
65 | } |
66 | } |
Began life as a copy of #1010574
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010746 |
Snippet name: | cachedNodeIndex2 - with automatic update on CE changes |
Eternal ID of this version: | #1010746/25 |
Text MD5: | 04920617f809c8c9526f748b66b6ac3f |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-08 17:57:42 |
Source code size: | 2052 bytes / 66 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 500 / 533 |
Version history: | 24 change(s) |
Referenced in: | [show references] |