TokenCache 类
这被视为包含最小缓存行为的基类。
尽管它在所有 MSAL 库中使用统一架构维护令牌,但此类不会序列化/保留它们。 有关序列化的详细信息,请参阅子类 SerializableTokenCache 。
构造函数
TokenCache()
方法
| add |
处理获取事件的令牌,并将令牌添加到缓存中。 |
| find |
等效于 list(search(...))。 |
| modify | |
| remove_account | |
| remove_at | |
| remove_idt | |
| remove_rt | |
| search |
返回匹配项的生成器。 对于 AT 命中,为 O(1),对于其他类型的 O(n)。 请注意,它在整个搜索过程中保留锁。 |
| update_rt |
add
处理获取事件的令牌,并将令牌添加到缓存中。
add(event, now=None)
参数
| 名称 | 说明 |
|---|---|
|
event
必需
|
|
|
now
|
默认值: None
|
find
等效于 list(search(...))。
find(credential_type, target=None, query=None, *, now=None)
参数
| 名称 | 说明 |
|---|---|
|
credential_type
必需
|
|
|
target
|
默认值: None
|
|
query
|
默认值: None
|
仅限关键字的参数
| 名称 | 说明 |
|---|---|
|
now
|
默认值: None
|
modify
modify(credential_type, old_entry, new_key_value_pairs=None)
参数
| 名称 | 说明 |
|---|---|
|
credential_type
必需
|
|
|
old_entry
必需
|
|
|
new_key_value_pairs
|
默认值: None
|
remove_account
remove_account(account_item)
参数
| 名称 | 说明 |
|---|---|
|
account_item
必需
|
|
remove_at
remove_at(at_item)
参数
| 名称 | 说明 |
|---|---|
|
at_item
必需
|
|
remove_idt
remove_idt(idt_item)
参数
| 名称 | 说明 |
|---|---|
|
idt_item
必需
|
|
remove_rt
remove_rt(rt_item)
参数
| 名称 | 说明 |
|---|---|
|
rt_item
必需
|
|
search
返回匹配项的生成器。
对于 AT 命中,为 O(1),对于其他类型的 O(n)。 请注意,它在整个搜索过程中保留锁。
search(credential_type, target=None, query=None, *, now=None)
参数
| 名称 | 说明 |
|---|---|
|
credential_type
必需
|
|
|
target
|
默认值: None
|
|
query
|
默认值: None
|
仅限关键字的参数
| 名称 | 说明 |
|---|---|
|
now
|
默认值: None
|
update_rt
update_rt(rt_item, new_rt)
参数
| 名称 | 说明 |
|---|---|
|
rt_item
必需
|
|
|
new_rt
必需
|
|