From f95d75ac9c5ee89361854257fc21908e056045c0 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 9 Aug 2019 16:09:47 +0100
Subject: [PATCH] ENH: Cache.__contains__ method

---
 fsl/utils/cache.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fsl/utils/cache.py b/fsl/utils/cache.py
index e8de25aa1..cf50a50aa 100644
--- a/fsl/utils/cache.py
+++ b/fsl/utils/cache.py
@@ -143,6 +143,13 @@ class Cache(object):
         return self.put(key, value)
 
 
+    def __contains__(self, key):
+        """Check whether an item is in the cache. Note that the item may
+        be in the cache, but it may be expired.
+        """
+        return key in self.__cache
+
+
     def __parseDefault(self, *args, **kwargs):
         """Used by the :meth:`get` method. Parses the ``default`` argument,
         which may be specified as either a positional or keyword argumnet.
-- 
GitLab