Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for delete_matched #128

Merged
merged 1 commit into from
Jan 12, 2024
Merged

Conversation

djmb
Copy link
Collaborator

@djmb djmb commented Jan 12, 2024

delete_matched is optional, it may be removed in Rails 8.0 and relies on the index on the key column which will be removed in future.

`delete_matched` is optional, it may be removed in Rails 8.0 and relies
on the index on the `key` column which will be removed in future.
@skatkov
Copy link
Contributor

skatkov commented Jan 12, 2024

This is great. After this gets merged, what will be next that should be resolved ? Hash index #94 or you will working on constraining cache storage to certain size #116 ?

@djmb
Copy link
Collaborator Author

djmb commented Jan 12, 2024

Hey @skatkov! I'll be working on the changes for key_hash next. It will include the migrations for size estimation as well so we only need one set of migrations.

The changes are straightforward, but the main problem will the migration steps for existing users. I'll be working through those and testing them out on our apps.

@skatkov
Copy link
Contributor

skatkov commented Jan 12, 2024

Do you need any assistance with key_hash @djmb?

@djmb djmb merged commit 5ae8e78 into main Jan 12, 2024
20 checks passed
@djmb djmb deleted the remove-delete-matched-support branch January 12, 2024 14:39
@djmb
Copy link
Collaborator Author

djmb commented Jan 12, 2024

@skatkov - I'll have something ready for it next week. We can then look at if a postgresql hash index fits in to what we've got.

@namolnad
Copy link

Hi there, I was previously using delete_matched until upgrading recently. After poking around a bit, I'm not seeing a good way to continue doing some of the things I was using solid_cache for. Namely, caching counts based on a the organization performing the query (org id used as a namespace) and the ActiveRecord cache_key to set the cache key for the filters which were applied for the query.

It appears that I can't even use a namespace to clear cache entries and will instead have to know the exact cache key. Am I correct in that assumption or is there some workaround/functionality I'm missing. Thanks!

@djmb
Copy link
Collaborator Author

djmb commented Mar 22, 2024

Hey @namolnad!

I removed delete_matched support as it requires a large index, and it's likely to be removed from the API for Rails 8, though I don't think that's official.

You can add support back in yourself though by:

  1. Adding an index on the key column
  2. Deleting entries directly with something like SolidCache::Entry.where("key like 'prefix%'").delete_in_batches

@namolnad
Copy link

@djmb thanks so much for the quick follow up and the workaround — I'll see if I can rework how I'm doing things, but this workaround may come in handy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants