Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing db caching functionality (#211)
* Implementing file cache functionality * Open or Create file * Refactoring code * Adding dbcache functionality * Adding dependencies * Updating dbcache * Updating dbcache * Updating dbcache * Removing unnecessary code * Fix linter issues * Adding tests * Adding tests * Adding interface * Setting up db cache within uhttp pkg * Adding validations * Adding expiration time * Adding expiration time * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Code review changes * Code review changes * Code review changes * Code review changes * Adding db transactions * Fix bug when database is locked * Fix tests * Adding BATON_IN_MEMORY_HTTP_CACHE env * Adding stats structure * Adding statistics * Adding statistics * Adding statistics * Adding statistics * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Code review changes * Refactoring code * Code review changes * Code review changes part 1 * Code review changes part 2 * Code review changes part 3 * Code review changes part 3 * Code review changes part 4 * Code review changes part 4 * Code review changes part 5 * Code review changes part 5 * Code review changes part 5 * Code review changes part 5 * Code review changes part 6 * Refactoring code * Refactoring code * Code review changes * Code review changes * Code review changes * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Refactoring code * Use goqu for sqlite like we do elsewhere in baton-sdk, removing the direct dependency on sqlite3. Start cleaning up DB cache code. * Fix linter error * Fix error where failing tests didn't cause CI to fail. * Upgrade github action versions. * Use latest version of golang-test-annotations. Output test results in a windows-compatible way. * Truncate tables on db cache initialization. Test setting same cache key again. * Update on conflict. Set default cache size to 50MB. * Clean up cache interface. Accept request instead of having to generate a cache key and pass in req.Context(). * Clean up cache config. Add noop cache instead of initializing a disabled mem or db cache. * Move cache config stuff into cache file. Don't create cachekey since get/set cache just needs req. Add tostring method to cache config. * Remove unused functions. * Use one variable for the cache we're returning. * Move all env var parsing into NewCacheConfigFromEnv. Clean up names and add caching behavior config. * Add TODO. * Add explicit GRPC call to clear caches/cleanup. Print cache stats. * Lots of DB cache cleanup. Use higher log levels for errors. Simplify functions. * Better function name for deleting expired cache entries. Fix stats calculations. * Make insert only accept bytes. Clean up pick() to build query and not return an error if no cache entry is found. * Add support for sparse mode in memory cache. Reduce default cache size from 50MB to 5MB. * Use request url, not response request url. * Error if we can't create the http cache. * Remove unused SqliteError. Cache clearing log line should be debug, not info. --------- Co-authored-by: Geoff Greer <geoff@greer.fm>
- Loading branch information