Dynamic grammar caching

In general, the grammar caching mechanism is unchanged when a compiled grammar uses dynamic linking to import other grammars.

However, there are a couple of caching differences:

  • Recognizer creates an additional “meta-grammar” to describe all the component grammars that have been imported. The meta-grammar is stored in memory and never on the disk cache.
  • Each component grammar is cached and refreshed independently as if it were a standalone grammar. In other words, the default caching behavior applies to each imported grammar.
  • Using the swirec_mem_flush_on_free property affects the top level meta-grammar, but not the imported grammars. You cannot force the imported grammars to be flushed from the memory cache. Instead, they are handled by the default cache management scheme (that is, they are flagged as remove-able at the discretion of the cache).