Skip to content
This repository has been archived by the owner on May 14, 2018. It is now read-only.

Cache system #145

Closed
wants to merge 14 commits into from
Closed

Cache system #145

wants to merge 14 commits into from

Conversation

pensiero
Copy link
Contributor

Add a cache system based on APC during the Authorize service load.

foreach ($this->serviceLocator->get('BjyAuthorize\RoleProviders') as $provider) {
$this->addRoleProvider($provider);
}
$cache = StorageFactory::factory(array(
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't create the cache here - instead, inject it and allow a null cache if none is set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, as a cosntructor param

Gamempire added 2 commits May 13, 2013 10:17
Moved $cache initialization to __constructor
Moved $cache initialization to __constructor
@@ -35,12 +35,14 @@
"require-dev": {
"doctrine/common": ">=2.3,<2.5-dev",
"zendframework/zend-developer-tools": "0.*",
"zf-commons/zfc-user": "0.*"
"zf-commons/zfc-user": "0.*",
"zendframework/zend-cache": "~2.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should work also for ~2.0

@Ocramius
Copy link
Contributor

Tests?

@pensiero
Copy link
Contributor Author

I have not enough time to learn how to test this :(

@Ocramius
Copy link
Contributor

News on this one?

@pensiero
Copy link
Contributor Author

I don't know how to test! :(


Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email: [email protected]
Email secondaria: [email protected]
Skype: gamempire
Tel: 3388696167

Il giorno 30/mag/2013, alle ore 18:20, Marco Pivetta [email protected] ha scritto:

News on this one?


Reply to this email directly or view it on GitHub.

@Ocramius Ocramius mentioned this pull request Jun 9, 2013
@cbergau
Copy link
Contributor

cbergau commented Jun 13, 2013

Hello, i really want a cache system. I have a lot of database queries because of BjyAuthorize getting the roles from the database. You don't know how to test because you didn't ever use PHPUnit?

@Ocramius
Copy link
Contributor

Go for it! I'm busy for at least another week...
On 13 Jun 2013 09:04, "Christian Bergau" [email protected] wrote:

Hello, i really want a cache system. I have a lot of database queries
because of BjyAuthorize getting the roles from the database. You don't know
how to test because you didn't ever use PHPUnit? If i see there is no more
effort put into this pull request, someone else (i could) must implement a
cache system here.


Reply to this email directly or view it on GitHubhttps://github.com//pull/145#issuecomment-19375422
.

@pensiero
Copy link
Contributor Author

@cbergau the cache system is working and I "manually" test it with some of my website (with a lot of old "var_dump"), but however is missing a real test with phpunit, because I have no time to study it, even though they are really very few lines of code.
rather than rewrite it, have you already take a look at my commits?

@cbergau
Copy link
Contributor

cbergau commented Jun 13, 2013

I just looked at your commits. I think its good. But i think its impossible to pass any options to the cache adapter right? Have a look at the Zend\Cache\StorageFactory. I think you should use the StorageFactory to create the cache instead of using "new".

BTW: You should definitely spend some time into PHPUnit, you won't regret :-)

use Zend\ServiceManager\ServiceManager;

/**
* Test for {@see \BjyAuthorize\Service\AuthorizeAwareServiceInitializer}
Copy link
Contributor

Choose a reason for hiding this comment

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

This @see is wrong

@cbergau
Copy link
Contributor

cbergau commented Jun 17, 2013

Okay, i can not explain why the Travis build fails, because i did not change any of the failing code :/ using PHPUnit 3.7.21 and PHP 5.4

@Ocramius
Copy link
Contributor

@cbergau that's not up to you - I think zendframework/zend-http is missing. I'll try locally tomorrow

@cbergau
Copy link
Contributor

cbergau commented Jun 18, 2013

Any news? :-)

@Ocramius
Copy link
Contributor

Nope, sorry... Wanted to check it in the midday break, but failed to
allocate time for it :
On 18 Jun 2013 22:00, "Christian Bergau" [email protected] wrote:

Any news? :-)


Reply to this email directly or view it on GitHubhttps://github.com//pull/145#issuecomment-19637800
.

@@ -8,8 +8,10 @@

namespace BjyAuthorize\Service;

use Zend\Cache\StorageFactory;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the StorageFactory and the ConsoleRequest in the use block.

{
$this->acl = new Acl();

foreach ($this->serviceLocator->get('BjyAuthorize\RoleProviders') as $provider) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not remove those loops and allow addRoleProvider(); to accept arrays too? Same for the others.
It's a kind of small BC change, but the end user behaviour remains the same

Copy link
Contributor

Choose a reason for hiding this comment

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

Not part of the cache stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, saw it, you've simply moved existing code ...

@cbergau
Copy link
Contributor

cbergau commented Jun 22, 2013

Hey, if you want, i can do try to find out whats wrong with the build, if this speeds it up :-)

@Ocramius Ocramius closed this in a30b4b3 Jun 25, 2013
@Ocramius
Copy link
Contributor

Manually merged (and squashed)

@AV4TAr
Copy link

AV4TAr commented Jul 5, 2013

This is a nice example of open source collaboration.. great work everybody.!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants