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

Post: Matryoshka #29

Merged
merged 10 commits into from Jan 20, 2015
Merged

Post: Matryoshka #29

merged 10 commits into from Jan 20, 2015

Conversation

marczych
Copy link
Contributor

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

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'
Copy link
Member

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.

Copy link
Contributor Author

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();
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with 36e3e33.

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with a721210.

@davidrans
Copy link
Member

This is awesome! It'll be so cool if the community starts to contribute.
CR ☕

It's not necessary and might lead to confusion.
@davidrans
Copy link
Member

CR ☕

It was noticeably smaller than the rest of the body text which was
distracting.
@marczych
Copy link
Contributor Author

I think I've addressed all of your concerns, @davidrans. Thanks for the feedback!

I also updated the style of inline code slightly: c4023f0

Before:
before

After:
after

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@xiongchiamiov
Copy link
Contributor

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!

@marczych
Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/that/which/ ?

@danielbeardsley
Copy link
Member

Even without my suggestions, this is a go. CR 🆗

MutantFreak and others added 3 commits January 20, 2015 13:42
Marc says this is plenty of changes for one commit.
@marczych marczych merged commit 78a826e into gh-pages Jan 20, 2015
marczych added a commit that referenced this pull request Jan 20, 2015
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
@marczych
Copy link
Contributor Author

Thanks again for all feedback! It's now live!

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.

None yet

5 participants