(args)
| 103 | keys = collections.deque() |
| 104 | |
| 105 | def get(args): |
| 106 | if args not in memory: |
| 107 | with lock: |
| 108 | if args not in memory: |
| 109 | fargs = args[-1] |
| 110 | memory[args] = func(*fargs) |
| 111 | keys.append(args) |
| 112 | if len(keys) > limit: |
| 113 | del memory[keys.popleft()] |
| 114 | return memory[args] |
| 115 | |
| 116 | else: |
| 117 |