laminas / laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output
https://docs.laminas.dev/laminas-cache/
BSD 3-Clause "New" or "Revised" License
98 stars 51 forks source link

Component split #7

Closed weierophinney closed 4 years ago

weierophinney commented 4 years ago

I would like to get your opinions about splitting zend-cache into different components. The reason for that is simply a testing and dependency hell.

In my opinion it makes sense to split parts into it's own repository as long as the part requires a non standard extension or another currently optional dependency.

Thoughts ?

This is a structure how this could look like:

zendframework/zend-cache


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93

weierophinney commented 4 years ago

This makes a ton of sense as far as I'm concerned; it's exactly what we're doing in zend-mvc currently.

I'd recommend:

With regards to the AdapterPluginManager, the new components should be made compatible with zend-component-installer. In doing so, you can have the Module class return configuration for the adapter plugin being exposed. (You should likely also do a ConfigProvider so folks can use it with Expressive!) I can provide more guidance on this aspect as needed.


Originally posted by @weierophinney at https://github.com/zendframework/zend-cache/issues/93#issuecomment-201058440

weierophinney commented 4 years ago

:+1: It's the logical continuation of the hard work done by @weierophinney.


Originally posted by @neeckeloo at https://github.com/zendframework/zend-cache/issues/93#issuecomment-201215012

weierophinney commented 4 years ago

@weierophinney sorry for the late response. Nice to hear your ACK.

There are some details I like to discuss before:

Cheers


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93#issuecomment-205970393

weierophinney commented 4 years ago

@weierophinney @Ocramius Today I had some time and moved already a lot of repos from zend-cache into it's own. Could you please take a look if that's on a good way? Thanks!

Cheers


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93#issuecomment-279153237

weierophinney commented 4 years ago

Sorry, I didn't join the discussion before.

Yes, this looks good, especially if we can manage to make the extension dependencies required when picking single packages (that would require requesting the single packages via composer, manually).

Unsure if the serializer needs to be extracted: probably worth keeping test, cache and serializer in a single package, while the adapters move each to a single component if they require particular extensions.

I'm also not sure if it's worth splitting out cache components that don't require extensions...


Originally posted by @Ocramius at https://github.com/zendframework/zend-cache/issues/93#issuecomment-279389974

weierophinney commented 4 years ago

@Ocramius Thanks for your comment!

I have moved the serializer plugin into another package as it requires the zend-serializer package. Same (will) happen to the session adapter which requires zend-session.

I'm also not sure if it's worth splitting out cache components that don't require extensions...

It's all about splitting out the parts require special dependencies. I have one exception only, the zend-cache-test package. This package contains some reusable / common tests and will be used by all other zend-cache* packages in development. The reason for that is that I want to have this dependency only for development require-dev and not on normal installations.

The following packages also needs to be moved:

Everything else should be kept in the main repo as it doesn't have special dependencies.

Right now I have one problem that I don't know how to solve: The component contains a factory StorageFactory used to instantiate storage adapters and plugins like

StorageFactory::factory([
    'adapter' => [
        'name'    => 'apc',
        'options' => ['ttl' => 3600],
    ],
    'plugins' => [
        'exception_handler' => ['throw_exceptions' => false],
    ],
]);

But how can I register the services on installation using the zend-component-installer?


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93#issuecomment-279394824

weierophinney commented 4 years ago

I have moved the serializer plugin into another package as it requires the zend-serializer package. Same (will) happen to the session adapter which requires zend-session.

Makes sense

Yes that's basically all about. I have one exception only, the zend-cache-test package. This package contains some reusable / common tests and will be used by all other zend-cache* packages in development. The reason for that is that I want to have this dependency only for development require-dev and not on normal installations.

Can't we just use the .gitattributes, as we already did thus far?


Originally posted by @Ocramius at https://github.com/zendframework/zend-cache/issues/93#issuecomment-279395252

weierophinney commented 4 years ago

@Ocramius There are actually the following problems:


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93#issuecomment-279846517

weierophinney commented 4 years ago

@Ocramius Also moved the zend-server adapters to an own repo and after several hours I could make the tests run on travis by installing Zend-Server, rewriting phpunit start script and testing over HTTP call :)

@weierophinney Please could you take a look at https://github.com/marc-mabe/zend-cache-zendserver/blob/master/.travis.yml and validate if that is ok and allowed how I run the tests.

Thanks.


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93#issuecomment-280883195

weierophinney commented 4 years ago

I love the idea of separating out the various storage adapters to their own repositories. That way users are only getting code related to the adapter(s) they use, and we can have much easier, more targeted instructions on contributing (typically via vagrant and/or docker).

I've looked at the zend-cache-zendserver Travis setup, and it looks reasonable.

Would this split target a v3 release, then? And I assume we'd want each adapter brought into the zendframework organization, and tagged with a stable 1.0.0 release before removing them here, correct?


Originally posted by @weierophinney at https://github.com/zendframework/zend-cache/issues/93#issuecomment-281752862

weierophinney commented 4 years ago

I've looked at the zend-cache-zendserver Travis setup, and it looks reasonable.

Thanks for review :smiley:

Would this split target a v3 release, then?

Yea, also I have one or two other things I want to archive for 3.0 because small BC break.

And I assume we'd want each adapter brought into the zendframework organization, and tagged with a stable 1.0.0 release before removing them here, correct?

Yes, of course before tagging a stable version of zend-cache with adapters removed the adapters have to have a stable version already and everything has to be in zendframework organization. I was planning to start with adapter versions with version 3.0 as the adapters had stable versions before within zend-cache.


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93#issuecomment-281786085

weierophinney commented 4 years ago

Does anyone have an idea or knows someone how would be able to test the WinCache adapter. I don't have a windows system at hand and even if so I would not like to fight setting up a microsoft webserver an windows in my free time.


Originally posted by @marc-mabe at https://github.com/zendframework/zend-cache/issues/93#issuecomment-281786691

weierophinney commented 4 years ago

@marc-mabe The only thing I can think of is to use a Windows vagrant image as a base, and then have the Vagrantfile download and install PHP to it. IIRC, Travis has windows images, too, which might make this possible there.


Originally posted by @weierophinney at https://github.com/zendframework/zend-cache/issues/93#issuecomment-281789316

weierophinney commented 4 years ago

As the support for APC dropped years ago and there is no compatible PHP 7+ version, shouldn't we drop support for that extension at all?


Originally posted by @boesing at https://github.com/zendframework/zend-cache/issues/93#issuecomment-419660748

weierophinney commented 4 years ago

@boesing We can when we bump to PHP 7.1.


Originally posted by @weierophinney at https://github.com/zendframework/zend-cache/issues/93#issuecomment-419671839

boesing commented 4 years ago

Closing this as we decided per TSC voting to do exactly this.

There is a project to follow the current state of this, so this Issue is not needed anymore.

Laminas cache satellites

Thanks for the original post which lead me into the direction we now approaching in an official project.