0 votes
in Ruby by
Within a Rails model with a cache_key method, which code snippet will expire the cache whenever the model is updated?

 A.

after_update_commit do

destroy

end

 B.

after_destroy do

Rails.cache.delete(cache_key)

end

 C.

after_update_commit do

Rails.cache.delete(cache_key)

end

 D.

after_update_commit do

Rails.cache.destroy(cache_key)

end

1 Answer

0 votes
by

Within a Rails model with a cache_key method, which code snippet will expire the cache whenever the model is updated?

Correct answer is :- after_update_commit do

Rails.cache.destroy(cache_key)

end

Related questions

0 votes
asked Sep 3, 2022 in Ruby by DavidAnderson
0 votes
asked Sep 3, 2022 in Ruby by DavidAnderson
...