Commit 4fdc94c
fix: honor server-reported Gemini cache expiry
The client derived cache expiry from the local clock right after creation, but network delay or server-side normalization can push the real expiry off that estimate and lead to reuse at the wrong boundary. This records the expire_time the API returns when present, and falls back to the local TTL only when the response omits it.
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 9479610201 parent 8de4237 commit 4fdc94c
2 files changed
Lines changed: 29 additions & 1 deletion
File tree
- src/google/adk/models
- tests/unittests/agents
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
532 | 533 | | |
533 | 534 | | |
534 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
535 | 542 | | |
536 | 543 | | |
537 | 544 | | |
538 | 545 | | |
539 | 546 | | |
540 | 547 | | |
541 | 548 | | |
542 | | - | |
| 549 | + | |
543 | 550 | | |
544 | 551 | | |
545 | 552 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
1157 | 1159 | | |
1158 | 1160 | | |
1159 | 1161 | | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
1160 | 1181 | | |
1161 | 1182 | | |
1162 | 1183 | | |
| |||
0 commit comments