]> gitweb.factorcode.org Git - factor.git/blob - basis/vocabs/cache/cache.factor
core/basis: Rename words dealing with vocabs to loaded-vocabs or disk-vocabs because...
[factor.git] / basis / vocabs / cache / cache.factor
1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs fry kernel namespaces memoize init sequences vocabs
4 vocabs.hierarchy vocabs.loader vocabs.metadata vocabs.refresh
5 words ;
6 IN: vocabs.cache
7
8 : reset-cache ( vocab -- )
9     vocab-name
10     [ root-cache get delete-at ]
11     [
12         \ vocab-file-contents "memoize" word-prop swap
13         '[ drop first vocab-name _ = ] assoc-reject! drop
14     ] bi
15     \ all-disk-vocabs-recursive reset-memoized
16     \ all-authors reset-memoized
17     \ all-tags reset-memoized ;
18
19 SINGLETON: cache-observer
20
21 M: cache-observer vocab-changed drop reset-cache ;
22
23 [
24     f changed-vocabs set-global
25     cache-observer add-vocab-observer
26 ] "vocabs.cache" add-startup-hook