Factored-out the state management in designated classes.#73
Factored-out the state management in designated classes.#73ndobromirov wants to merge 11 commits intolcache:masterfrom
Conversation
…ween L1 cache implementations and their respective state handlers.
…y instantiating L1 concrete classes.
…thods on the StateL1Null class.
|
🎉 After some struggles with the build this seems ready for review :) |
That's the only mode I have enabled for this project. If something requires multiple, isolated changes, I'd prefer to break them up into different pull requests, anyway. |
davidstrauss
left a comment
There was a problem hiding this comment.
I mentioned a small change, but I'd like to hold off on merging this until I finish investigating RocksDB as an L1 option. Isolating L1 metadata from L1 storage will only be necessary if we go with SQLiteL1.
src/APCuL1.php
Outdated
| $apcu_key = $this->getLocalKey($address); | ||
| $overhead = apcu_fetch($apcu_key . ':overhead', $success); | ||
| if ($success) { | ||
| if ($success === true) { |
There was a problem hiding this comment.
Can we swap these to be true === $success here and in similar places. It just minimizes the chance of accidentally assigning instead of comparing. I'll probably fix all other conditions at some point to be this way.
…tored 2 loops in StaticL2 to reduce code indentation.
|
I would say the separation is good to be available either way. |
That's a good point. APCu isn't going to cut it for L1, so we'll want to keep something around for more basic users. |
|
PR #76 was based on this one and it is now merged, making one obsolete. Closing. |
Overview
This pull request:
Summary
Draft Implementation of #63
Description
We have a different classes that handle the L1 states.
Current implementations are: APCu, Static and NULL.
Maybe add SQLite one.
Update:
Improved in-line docks.
Based on discussion in the issue, decided to go with constructor injection for both pool and state StateL1 handler instance for all L1Cache drivers.
Added a factory to simplify the construction of any L1 instance, as we need to inject more dependencies now. Moved the POOL value generation in the factory (for now).
Re-factored tests to use the factory instead of directly instantiating the concrete L1 instances.