Persistent answer caching

This repo defines a SWI-Prolog library cache_rocks, which uses a RocksDB interface to provide persistent caching of answers. The answers are associated with a deep hash of the involved predicates, which means that they are invalidated when one of the predicates that are reachable from the call tree starting with the predicate associated with the goal changes.




Prolog files

pack.plShow source
prolog/  -- Persistent answer cachingShow source
cache_close/0Close an previously opened persistent cache directory.Source
cache_dynamic/1Declare Head to be a dynamic predicate that is stored in the cache with a given mode.Source
cache_listing/0List contents of the persistent cache.Source
cache_listing/1List contents of the persistent cache.Source
cache_open/1Open an answer cache in Directory.Source
cache_property/2Query properties of the cache.Source
cache_retract/1True when Fact appeared in the database and could be retracted.Source
cache_retractall/1Retract all terms unifying with Fact.Source
cache_statistics/1True when Key is a know statistics about the caching mechanism.Source
cached/1This predicate is logically equivalent to Goal.Source
cached/2Get the answers for Goal from an old hashed result.Source
forget/1Forget all cached results that are subsumed by Goal.Source
this_cache_property/2Query properties of the cache.Source
prolog/  -- Create signatures for a programShow source
deep_predicate_hash/2Compute the predicate hash of Head and all its callees and combine this into a single hash.Source
goal_provenance/2Establish the provenance information for computing Goal.Source
goal_signature/2Replace the module and functor of Goal with a hash.Source
goal_signature/3Replace the module and functor of Goal with a hash.Source
hook_predicate_hash/2Hook that can be used to define the signature of a predicate.Source
predicate_dependencies/2True when Callees is a set (ordered list) of all predicates that are directly or indirectly reachable through Head.Source
sig_clean_cache/0Cleanup cached signatures and dependencies.Source
sig_clean_cache/1Cleanup cached signatures and dependencies.Source
test/demo.plShow source
test/test_pcache.plShow source