-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workspace cache #632
workspace cache #632
Conversation
|
||
```js | ||
const cache = await workspace.cache("summary") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect use of 'await' outside of an async function.
generated by pr-docs-review-commit
await_usage
const cache = await workspace.cache("summary") | ||
// write entries | ||
await cache.set("file.txt", "...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect use of 'await' outside of an async function.
generated by pr-docs-review-commit
await_usage
await cache.set("file.txt", "...") | ||
// read entries | ||
const content = await cache.get("file.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect use of 'await' outside of an async function.
generated by pr-docs-review-commit
await_usage
values: async () => | ||
res.entries().then((es) => es.map((e) => e.val)), | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no error handling for the JSONLineCache.byName<any, any>(name)
function call. If this function fails, it could lead to unexpected behavior. Consider adding error handling to improve the robustness of your code. 😊
generated by pr-review-commit
missing_error_handling
@@ -105,6 +104,7 @@ export async function createPromptContext( | |||
readJSON: (f) => runtimeHost.workspace.readJSON(f), | |||
readXML: (f) => runtimeHost.workspace.readXML(f), | |||
writeText: (f, c) => runtimeHost.workspace.writeText(f, c), | |||
cache: (n) => runtimeHost.workspace.cache(n), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The runtimeHost.workspace.cache(n)
function call lacks error handling. If this function fails, it could lead to unexpected behavior. It's a good practice to handle potential errors to make your code more reliable. 😊
generated by pr-review-commit
missing_error_handling
*/ | ||
cache<K = any, V = any>( | ||
cacheName: string | ||
): Promise<WorkspaceFileCache<K, V>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache<K = any, V = any>(cacheName: string)
function does not validate the types of its parameters. This could lead to unexpected behavior if the function is called with incorrect types. Consider adding type validation to improve the robustness of your code. 😊
generated by pr-review-commit
missing_type_validation
Simple KV store to implement cheap memories in scripts