Skip to content

Commit

Permalink
Add experimental cache-model-properties resource feature
Browse files Browse the repository at this point in the history
The cache-model-properties resource feature allows caching of model
properties on a per-resource basis.  This means that you can set some
resources not to have their model properties cached, whilst others
would have such a cache.

Use :features '(cache-model-properties) in the define-resource.

This feature is EXPERIMENTAL.  We intend to merge this feature with
other features and/or to merge it over time.
  • Loading branch information
madnificent committed Dec 2, 2018
1 parent b90ff80 commit e44af1c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion framework/call-implementation.lisp
Expand Up @@ -455,9 +455,15 @@
The resources might not be complete yet, and can be finished.
The keys are the UUIDs the vaue is the cached resource.")

(defun cache-model-properties-p (item-spec)
"Yields a truethy result iff the model properties for the supplied
item-spec should be cached."
(or *cache-model-properties-p*
(find 'cache-model-properties (features (resource item-spec)))))

(defun ensure-solution (item-spec)
"Ensures a solution exists for <item-spec> and returns it."
(if *cache-model-properties-p*
(if (cache-model-properties-p item-spec)
(or (get-ua-hash (uuid item-spec) *cached-resources*)
(setf (get-ua-hash (uuid item-spec) *cached-resources*)
(make-instance 'solution)))
Expand Down

0 comments on commit e44af1c

Please sign in to comment.