mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-28 10:32:27 +08:00
20 lines
600 B
JavaScript
20 lines
600 B
JavaScript
![]() |
/**
|
||
|
* Purpose of this class is to cache list of attributes for notes.
|
||
|
*
|
||
|
* Cache invalidation granularity is global - whenever a write operation is detected to notes, branches or attributes
|
||
|
* we invalidate the whole cache. That's OK, since the purpose for this is to speed up batch read-only operations, such
|
||
|
* as loading the tree which uses attributes heavily.
|
||
|
*/
|
||
|
class NoteAttributeCache {
|
||
|
constructor() {
|
||
|
this.attributes = {};
|
||
|
}
|
||
|
|
||
|
invalidate() {
|
||
|
this.attributes = {};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const noteAttributeCache = new NoteAttributeCache();
|
||
|
|
||
|
export default noteAttributeCache;
|