Perfomance optimization - adding transients #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following up on the conversation in issue #74 , I added transients to your plugin. It is now not necessary anymore to loop through all cart sessions but only to consult the value of this transient.
Once a product is added to the cart, the transient is set. It will be updated on any quantity changes. The transient is removed after the cart item expires or when the order is generated from the cart items.
Expiration time is calculated in seconds based on what users set up as an expiration time. If Expire Items is unchecked, expiration time is at 0, thus without any.
I did some basic testing, nothing extensive.
Possible issues:
Looking forward to hear your thoughts on this.