r2dbc-mssql
r2dbc-mssql copied to clipboard
Add support for configuring PreparedStatementCache
Make sure that:
- [x] You have read the contribution guidelines.
- [x] You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
- [x] You use the code formatters provided here and have them applied to your changes. Don't submit any formatting related changes.
- [x] You submit test cases (unit or integration tests) that back your changes.
Issue description
https://github.com/r2dbc/r2dbc-mssql/issues/227 - Allow configuring the prepared statement cache
New Public APIs
- PreparedStatementCache is now
public. - Added discovery option
preparedStatementCache.
Additional context
The preparedStatementCache discovery option behaves similar to the one in r2dbc-postgresql.
- -1 = indefinite cache
- 0 = no cache
- n = LRU cache with max size n.
- Additionally, it also accepts the class name of a
PreparedStatementCacheimplementation.
Thanks a lot. For a proper implementation of the cache we need to call sp_unprepare <handle> somewhere, ideally when the cache entry is being removed. Calling unprepare can interfere with the ongoing query so that might require some special attention.
For now, can we provide only NoPreparedStatementCache to allow disabling cache ? If it is ok i can create new PR.