Skip to content

Commit

Permalink
new serialized cache support
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Dec 11, 2017
1 parent 68bf9f8 commit 6b56808
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/appier_extras/parts/contentful/partials/_contentful.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,15 @@ def _contentful_deref(cls, entry, entries):
return None

@classmethod
def _get_contentful_cache(cls):
def _get_contentful_cache(cls, serialize = True):
if cls._contentful_cache: return cls._contentful_cache
cache_engine = appier.conf("CACHE", "memory")
cache_engine = appier.conf("CMS_CACHE_ENGINE", cache_engine)
cache_engine = appier.conf("CONTENTFUL_CACHE_ENGINE", cache_engine)
cache_engine = cache_engine.capitalize() + "Cache"
cache_engine = getattr(appier, cache_engine)
cls._contentful_cache = cache_engine()
if serialize: cls._contentful_cache = appier.SerializedCache(cls._contentful_cache)
return cls._contentful_cache

def contentful_image(
Expand Down
3 changes: 2 additions & 1 deletion src/appier_extras/parts/prismic/partials/_prismic.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ def _prismic_deref(cls, entry):
return entry

@classmethod
def _get_prismic_cache(cls):
def _get_prismic_cache(cls, serialize = True):
if cls._prismic_cache: return cls._prismic_cache
cache_engine = appier.conf("CACHE", "memory")
cache_engine = appier.conf("CMS_CACHE_ENGINE", cache_engine)
cache_engine = appier.conf("PRISMIC_CACHE_ENGINE", cache_engine)
cache_engine = cache_engine.capitalize() + "Cache"
cache_engine = getattr(appier, cache_engine)
cls._prismic_cache = cache_engine()
if serialize: cls._prismic_cache = appier.SerializedCache(cls._prismic_cache)
return cls._prismic_cache

def prismic_value(
Expand Down

0 comments on commit 6b56808

Please sign in to comment.