2009-05-04 07:44:17 -04:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2012-08-13 15:30:17 -04:00
|
|
|
USING: assocs fry init kernel memoize namespaces sequences
|
|
|
|
vocabs vocabs.hierarchy vocabs.loader vocabs.metadata
|
|
|
|
vocabs.refresh words ;
|
2009-05-04 07:44:17 -04:00
|
|
|
IN: vocabs.cache
|
|
|
|
|
2012-08-13 15:05:42 -04:00
|
|
|
: reset-cache ( vocab -- )
|
2012-08-13 15:24:14 -04:00
|
|
|
vocab-name
|
|
|
|
[ root-cache get-global delete-at ]
|
|
|
|
[
|
2012-08-13 15:36:02 -04:00
|
|
|
\ vocab-file-contents "memoize" word-prop
|
2012-08-13 15:30:17 -04:00
|
|
|
'[ drop first vocab-name _ = not ] assoc-filter! drop
|
2012-08-13 15:24:14 -04:00
|
|
|
] bi
|
2009-07-06 05:55:23 -04:00
|
|
|
\ all-vocabs-recursive reset-memoized
|
2009-05-04 07:44:17 -04:00
|
|
|
\ all-authors reset-memoized
|
|
|
|
\ all-tags reset-memoized ;
|
|
|
|
|
|
|
|
SINGLETON: cache-observer
|
|
|
|
|
2012-08-13 15:05:42 -04:00
|
|
|
M: cache-observer vocab-changed drop reset-cache ;
|
2009-05-04 07:44:17 -04:00
|
|
|
|
|
|
|
[
|
|
|
|
f changed-vocabs set-global
|
|
|
|
cache-observer add-vocab-observer
|
2009-10-19 22:17:02 -04:00
|
|
|
] "vocabs.cache" add-startup-hook
|