def GetEntityViaMemcache(entity_key):
    entity = memcache.get(entity_key)
    if entity is not None:
        return entity
    key = ndb.Key(urlsafe=entity_key)
    entity = key.get()
    if entity is not None:
        memcache.set(entity_key, entity)
    return entity
# [END datastore_example_1]


# [START datastore_example_test]
.. versionadded:: 1.0
dataset/ETHPy150Open GoogleCloudPlatform/python-docs-samples/appengine/localtesting/datastore_test.py/GetEntityViaMemcache--crossover with--dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/models/managers.py/ContentItemManager.translated