Set a value in the cache if the key does not already exist. If timeout is given, use that timeout for the key; otherwise use the default cache timeout. Return True if the value was stored, False otherwise.
(self, key, value, timeout=DEFAULT_TIMEOUT, version=None)
| 125 | return key |
| 126 | |
| 127 | def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): |
| 128 | """ |
| 129 | Set a value in the cache if the key does not already exist. If |
| 130 | timeout is given, use that timeout for the key; otherwise use the |
| 131 | default cache timeout. |
| 132 | |
| 133 | Return True if the value was stored, False otherwise. |
| 134 | """ |
| 135 | raise NotImplementedError( |
| 136 | "subclasses of BaseCache must provide an add() method" |
| 137 | ) |
| 138 | |
| 139 | async def aadd(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): |
| 140 | return await sync_to_async(self.add, thread_sensitive=True)( |
no outgoing calls
no test coverage detected