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
Post: Matryoshka #29
Post: Matryoshka #29
Conversation
I figured it's about time I wrote a blog post about Matryoshka explaining why we wrote it and how we use it. Any feedback is appreciated!
// then results in a key of '0fb4ae36-key'. | ||
$cache->set('key', 'value'); | ||
$cache->set('key2', 'value2'); | ||
$value = $cache->get('key'); // '0fb4ae36-key2' => 'value' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment should be:
// '0fb4ae36-key' => 'value'`.
That is, key
instead of key2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed with 945907d.
`getAndSet` makes populating the cache dead simple: | ||
|
||
{% highlight php startinline=true %} | ||
$cache = new Matryoshka\Ephemeral(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you haven't mentioned Ephemeral
before this, it could be confusing to readers. They may infer that the helper functions are associated with this Backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right. Just remove it I guess? Referencing $cache
down below without defining it in this block is probably fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you could use Matryoshka\Memcache::create($memcache)
, but they probably get the idea by now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 36e3e33.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's still one instance of Ephemeral
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with a721210.
This is awesome! It'll be so cool if the community starts to contribute. |
It's not necessary and might lead to confusion.
CR ☕ |
It was noticeably smaller than the rest of the body text which was distracting.
I think I've addressed all of your concerns, @davidrans. Thanks for the feedback! I also updated the style of inline code slightly: c4023f0 |
Similarly, `getAndSetMultiple` makes doing multi-gets significantly easier: | ||
|
||
{% highlight php startinline=true %} | ||
// Array of key => id. The id's can be anything used to identify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be ids
, without the apostrophe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right you are! Fixed with 253b9df.
I'm familiar with the project (we talked about it at length while you were designing it), but I think it's a pretty good explanation, and a well-written piece overall! |
Thanks for all the great feedback, @xiongchiamiov and @davidrans! I'd like to publish this sooner rather than later. Mind taking at least a cursory glance at this, @danielbeardsley? |
Like most websites, we make heavy use of caching to reduce load on our servers and decrease page response times. | ||
Our caching daemon of choice is [memcached]. | ||
The PHP extensions are certainly usable and provide all of the core functionality that you could need. | ||
However, we use a lot of patterns to make our day to day caching much easier that aren't provided by the extensions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/that/which/
?
Even without my suggestions, this is a go. CR 🆗 |
Marc says this is plenty of changes for one commit.
Because grammar.
Post: Matryoshka I figured it's about time I wrote a blog post about Matryoshka explaining why we wrote it and how we use it. Any feedback is appreciated! @davidrans @danielbeardsley
Thanks again for all feedback! It's now live! |
I figured it's about time I wrote a blog post about Matryoshka
explaining why we wrote it and how we use it.
Any feedback is appreciated!
@davidrans @danielbeardsley