Skip to content

What Is Actually Getting Cached? #25

@ez4bk

Description

@ez4bk

What is cached as value in the chosen cache?

I looked up the implementation code a bit, which states that the value is a query struct that stores db.Statement.Dest and db.Statement.RowsAffected. But I'm not really sure what is db.Statement.Dest? Is it going to be raw result from the database? If so, in what datatype? Or is it going to be the pointer to the model corresponding to the table?

In my project, I have a DAO method to determine if there is any data with field foreign_id = x. With both querying from the cache, if I use .First() and cache the row result, the performance is a lot worse than using .Count() which I believe cache only a number. So I wonder what causes the different.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions