=== modified file 'django/core/cache/backends/base.py'
--- django/core/cache/backends/base.py	2006-12-19 04:35:09 +0000
+++ django/core/cache/backends/base.py	2007-04-14 05:56:10 +0000
@@ -54,3 +54,9 @@
         Returns True if the key is in the cache and has not expired.
         """
         return self.get(key) is not None
+
+    def __contains__(self, key):
+        """
+        Allow use of 'in' operator.
+        """
+        return self.has_key(key)

=== modified file 'tests/regressiontests/cache/tests.py'
--- tests/regressiontests/cache/tests.py	2006-12-19 04:35:09 +0000
+++ tests/regressiontests/cache/tests.py	2007-04-14 06:06:00 +0000
@@ -46,6 +46,12 @@
         self.assertEqual(cache.has_key("hello"), True)
         self.assertEqual(cache.has_key("goodbye"), False)
 
+    def test_in(self):
+        # has_key
+        cache.set("hello", "goodbye")
+        self.assertEqual("hello" in cache, True)
+        self.assertEqual("goodbye" in cache, False)
+
     def test_data_types(self):
         # test data types
         stuff = {

