mirror of https://github.com/go-gitea/gitea.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1960ad5c90
Related to: #22294 #23186 #23054 Replace: #23218 Some discussion is in the comments of #23218. Highlights: - Add Expiration for cache context. If a cache context has been used for more than 10s, the cache data will be ignored, and warning logs will be printed. - Add `discard` field to `cacheContext`, a `cacheContext` with `discard` true will drop all cached data and won't store any new one. - Introduce `WithNoCacheContext`, if one wants to run long-life tasks, but the parent context is a cache context, `WithNoCacheContext(perentCtx)` will discard the cache data, so it will be safe to keep the context for a long time. - It will be fine to treat an original context as a cache context, like `GetContextData(context.Backgraud())`, no warning logs will be printed. Some cases about nesting: When: - *A*, *B* or *C* means a cache context. - ~*A*~, ~*B*~ or ~*C*~ means a discard cache context. - `ctx` means `context.Backgrand()` - *A(ctx)* means a cache context with `ctx` as the parent context. - *B(A(ctx))* means a cache context with `A(ctx)` as the parent context. - `With` means `WithCacheContext` - `WithNo` means `WithNoCacheContext` So: - `With(ctx)` -> *A(ctx)* - `With(With(ctx))` -> *A(ctx)*, not *B(A(ctx))* - `With(With(With(ctx)))` -> *A(ctx)*, not *C(B(A(ctx)))* - `WithNo(ctx)` -> *ctx*, not *~A~(ctx)* - `WithNo(With(ctx))` -> *~A~(ctx)* - `WithNo(WithNo(With(ctx)))` -> *~A~(ctx)*, not *~B~(~A~(ctx))* - `With(WithNo(With(ctx)))` -> *B(~A~(ctx))* - `WithNo(With(WithNo(With(ctx))))` -> *~B~(~A~(ctx))* - `With(WithNo(With(WithNo(With(ctx)))))` -> *C(~B~(~A~(ctx)))* |
2 years ago | |
---|---|---|
.. | ||
actions | 2 years ago | |
agit | 2 years ago | |
asymkey | 2 years ago | |
attachment | 2 years ago | |
auth | 2 years ago | |
automerge | 2 years ago | |
context | 2 years ago | |
convert | 2 years ago | |
cron | 2 years ago | |
externalaccount | 2 years ago | |
forms | 2 years ago | |
gitdiff | 2 years ago | |
issue | 2 years ago | |
lfs | 2 years ago | |
mailer | 2 years ago | |
markup | 2 years ago | |
migrations | 2 years ago | |
mirror | 2 years ago | |
org | 2 years ago | |
packages | 2 years ago | |
pull | 2 years ago | |
release | 2 years ago | |
repository | 2 years ago | |
task | 2 years ago | |
user | 2 years ago | |
webhook | 2 years ago | |
wiki | 2 years ago |