Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+211) |
Cache: cache
Review Request #528 — Created Aug. 14, 2017 and submitted
Information | |
---|---|
p.valk | |
Lunr | |
cache2 | |
2a326cb... | |
Reviewers | |
lunr | |
psuedocode example of how to implement it inside a controller.
public function foo() { $key = 'some unique identifier'; $cache = new cacheprovider(...); $values = $cache->get($key); if ($values === FALSE) { $values = $api->get_entries($type, $filter); $cache->set($key, $values); } } // Return data. return $values; }
Description: |
|
---|
Description: |
|
---|
-
-
-
-
-
-
-
-
src/Lunr/Gravity/CacheController.php (Diff revision 2) Why do we need to do this here? It has nothing to do with getting data from the cache.
-
src/Lunr/Gravity/CacheController.php (Diff revision 2) Incomplete documentation
Order of params doesn't match implementation -
src/Lunr/Gravity/CacheController.php (Diff revision 2) I don't know what you mean with singleton, but this class should be completely reentrant. I should be able to call get() and set() in any order with any keys and it should work without causing side effects.
-
-
Change Summary:
we would need to decidde on a default ttl value.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+132 -1) |
-
-
-
-
-
src/Lunr/Gravity/CacheController.php (Diff revision 3) "get" is enough.
This will most likely be $cache->get(), so $cache->get_cache() would just have useless information.
-
-
-
-
src/Lunr/Gravity/CacheController.php (Diff revision 3) set() is enough
a 30 second default is rather short. That's fine for really high traffic sites, but for low traffic sites that just means there won't ever be a cache hit. Make it like 5 or 10 minutes.
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+226 -2) |
-
-
src/Lunr/Gravity/CacheController.php (Diff revision 4) please don't call it a controller. Controller methods are accessible via web/cli, which these clearly shouldn't be.
-
-
-
-
src/Lunr/Gravity/CacheController.php (Diff revision 4) you can do $item->get() inside the if statement
-
-
src/Lunr/Gravity/CacheController.php (Diff revision 4) I think it's easier to follow the code if you do this in two steps
-
-
src/Lunr/Gravity/CacheController.php (Diff revision 4) How can the parameter be int and still need to be cast to Int? Don't accomodate for people refusing to follow the rules.
-
tests/test.bootstrap.inc.php (Diff revision 4) Naming here follows the namespace naming (making this wrong)
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+515 -2) |
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+514 -2) |
-
-
-
src/Lunr/Cache/Cache.php (Diff revision 6) We're not actually requiring any Stash specifics here, so we should depend on the PSR-6 interface only
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+514 -2) |
-
-
composer.json (Diff revision 7) we don't need stash anymore, only psr-6.
Projects may choose stash as a psr-6 implementation
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+443 -2) |
Description: |
|
---|
-
-
-
-
src/Lunr/Cache/Tests/CacheHandlerTest.php (Diff revision 8) This should be Psr, can't have tests determine implementation
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 9 (+443 -2) |