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

[Help wanted] Element API Cache Key #55

Closed
JoshStaff opened this issue Aug 8, 2017 · 1 comment
Closed

[Help wanted] Element API Cache Key #55

JoshStaff opened this issue Aug 8, 2017 · 1 comment
Labels

Comments

@JoshStaff
Copy link

Hi all,

I'm creating an API for a react native app to consume and would like to do some cache busting in the background, I'm currently able to achieve the results I want with

craft()->cache->flush()

but that clears the entire entry cache, I would like to manually delete the element api cache but can't for the life of me work out what the key is. Is there anyone that can assist me?

Thanks

@angrybrad
Copy link
Member

You can see the cache key being built here: https://github.com/craftcms/element-api/blob/v1/elementapi/controllers/ElementApiController.php#L59

It's a combination of elementapi: + the current URL path + : + the current URL query string. You'd want to use craft()->cache->delete() to delete specific keys instead of flush() which deletes everything.

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

No branches or pull requests

2 participants