Skip to content

Commit d9d0246

Browse files
committed
update readme
1 parent 8b64242 commit d9d0246

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,24 @@ def func(arg):
137137

138138
```thread_safe``` is ```True``` by default. Setting it to ```False``` enhances performance.
139139

140+
### Order-independent cache key
141+
142+
By default, the following function calls will be treated differently and cached twice, which means the cache misses at the second call.
143+
144+
```python
145+
func(a=1, b=1)
146+
func(b=1, a=1)
147+
```
148+
149+
You can avoid this behavior by passing an `order_independent` argument to the decorator, although it will slow down the performance a little bit.
150+
151+
```python
152+
@cached(order_independent=True)
153+
def func(**kwargs):
154+
...
155+
```
156+
157+
140158
### Knowing how well the cache is behaving
141159

142160
```python

0 commit comments

Comments
 (0)