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

Split cache from Connection::class. #197

Merged
merged 11 commits into from Dec 2, 2020
Merged

Split cache from Connection::class. #197

merged 11 commits into from Dec 2, 2020

Conversation

terabytesoftw
Copy link
Member

@terabytesoftw terabytesoftw commented Nov 12, 2020

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

Split cache from Connection::class:

  • Add SchemaCache::class and QueryCache::class.
  • Clean more code.
  • Update tests.
  • Implement Psr\SimpleCache\CacheInterface.

The configuration for the cache is very simple example:

return [
    Aliases::class => [
        '@root' => dirname(__DIR__, 1),
        '@data' =>  '@root/tests/Data',
        '@runtime' => '@data/runtime',
    ],

    CacheInterface::class => [
        '__class' => Cache::class,
        '__construct()' => [
            Reference::to(ArrayCache::class)
        ]
    ],

    SimpleCacheInterface::class => CacheInterface::class,

    LoggerInterface::class => Logger::class,

    ConnectionInterface::class  => [
        '__class' => Connection::class,
        '__construct()' => [
            'dsn' => $params['yiisoft/db-pgsql']['dsn']
        ],
        'setUsername()' => [$params['yiisoft/db-pgsql']['username']],
        'setPassword()' => [$params['yiisoft/db-pgsql']['password']]
    ]
];

Everything is solved by di-container autowired.

src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Cache/QueryCache.php Outdated Show resolved Hide resolved
src/Schema/Schema.php Outdated Show resolved Hide resolved
src/Schema/Schema.php Outdated Show resolved Hide resolved
@samdark samdark added status:under development Someone is working on a pull request. and removed status:code review The pull request needs review. labels Nov 27, 2020
@terabytesoftw terabytesoftw added status:code review The pull request needs review. and removed status:under development Someone is working on a pull request. labels Dec 1, 2020
@terabytesoftw terabytesoftw merged commit c5030bf into yiisoft:master Dec 2, 2020
@terabytesoftw terabytesoftw deleted the split-cache-connection branch December 2, 2020 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants