acts-as-taggable-on icon indicating copy to clipboard operation
acts-as-taggable-on copied to clipboard

How to use cache appropriately?

Open darkamenosa opened this issue 2 years ago • 1 comments
trafficstars

Hi @mbleigh,

First of all, I want to thank you for the wonderful library.

Forgive me to ask a dumb question. How to use cache appropriately?

I followed this https://github.com/mbleigh/acts-as-taggable-on/wiki/Caching to create cached tags. I also finished the migration. However, I don't know what is the correct way to use the cached tag.

I can use the cached_<somename>_list field directly. But I don't feel like it is the right way to do it. I'm assuming that just use the library the normal way, and it will automatically query cached_<somename>_list first, before doing anything else.

Is my assumption wrong?

Thank you for your time, and have a nice day ahead!

Tom

darkamenosa avatar May 09 '23 09:05 darkamenosa

it's the right way to do it. if you call the @model.cached_<column_name>_list, it'll get the record from the column. no extra query to ActAsTaggableOn table.

you are doing the right thing 🍻

chakraskun avatar Mar 01 '24 03:03 chakraskun