As for ActiveRecord for rails, I think it caches SQL query results.
In the log, click
Save the and Load to cache and display the query execution time.
indicates that it was retrieved from the cache and also shows how long it took to retrieve it from the cache.
I understand that
So, is it not possible to display the amount of memory being cached?
It doesn't matter if it's not logged, it can be checked every time.
If you insert middleware like this, it will come off.
If you run
bundle execrake middleware, you will see the line
In the Rack middleware that ActiveRecord plugs into, this middleware caches the results of the same query being requested.
Specifically, the following parts are inserted.
Specifically, if you read the QueryCache middleware implementation, you can call
connection.enable_query_cache! and then process the request.
@query_cache_enabled is set to
@query_cache_enabled is configured, the results of the select statement are cached in
If you read
cache_sql, you will see that
@query_cache has cached the results.
If you measure the size of the cache here, you will see how much memory you are consuming.
"If you google with the keyword ""ruby memory profiler"", you will get a lot of information."
I've never used it before, so I can't show you how to do it, but if you look at the sources above, you may get answers to the questions.
© 2023 OneMinuteCode. All rights reserved.