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

$wpdb->delete() can't really be cached #180

Closed
JDGrimes opened this issue Jun 25, 2014 · 6 comments · Fixed by #206
Closed

$wpdb->delete() can't really be cached #180

JDGrimes opened this issue Jun 25, 2014 · 6 comments · Fixed by #206

Comments

@JDGrimes
Copy link
Contributor

Calling $wpdb->delete() is flagged as an uncached query. Of course, a delete operation can't really be cached. Same goes for update and insert. However, I do suppose that in many cases they should perhaps still be accompanied by a cache update.

So perhaps this should be left as it is, but it seems odd to me.

Related #178

@shadyvb
Copy link
Contributor

shadyvb commented Jul 12, 2014

The message does seem odd for such functions, tracing cache update would probably be difficult since it can be done through other function.

@JDGrimes
Copy link
Contributor Author

JDGrimes commented Feb 7, 2015

The PR was merged and released in 0.3.0. I guess this is fixed.

@JDGrimes JDGrimes closed this as completed Feb 7, 2015
@samwilson
Copy link
Contributor

I'm still getting an error with $wpdb->delete(). I'm using the latest on the develop branch.

@samwilson
Copy link
Contributor

Sorry... here's a minimal code example that triggers the error I'm getting:

<?php
/**
 * A demonstration of WPCS failing on $wpdb->delete().
 *
 * @file
 * @package phpcs
 */

$wpdb->delete();

@JDGrimes
Copy link
Contributor Author

See b7d5416. $wpdb->delete() should probably be accompanied by a wp_cache_delete() or wp_cache_set() depending on the nature of the cache.

@JDGrimes
Copy link
Contributor Author

So in other words, this was reverted by #400.

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