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
How to use it ? #1
Comments
Hi, In Symfony with flysystem-bundle you'd just need to configure the service like this:
And then use it in
|
I have a little trouble understanding. Basically, my setup is as follows: flysystem.yaml : flysystem:
storages:
uploads_adapter:
adapter: 'aws'
options:
client: Aws\S3\S3Client
bucket: '%env(AWS_S3_BUCKET_NAME)%' services.yaml: Aws\S3\S3Client:
arguments:
- version: '2006-03-01'
region: "%env(AWS_S3_REGION)%"
credentials:
key: "%env(AWS_S3_ACCESS_ID)%"
secret: "%env(AWS_S3_ACCESS_SECRET)%" liip_imagine.yaml: liip_imagine:
# valid drivers options include "gd" or "gmagick" or "imagick"
driver: "gd"
loaders:
flysystem_loader:
flysystem:
filesystem_service: uploads_adapter
# Default loader to use for all filter sets
data_loader: flysystem_loader
resolvers:
flysystem_resolver:
flysystem:
filesystem_service: uploads_adapter
root_url: '%uploads_base_url%'
cache_prefix: media/cache
cache: flysystem_resolver So, if I understand, I should make this : Add in services.yaml : flysystem.cache.adapter:
class: Lustmored\Flysystem\Cache\CacheAdapter
arguments:
$adapter: '@flysystem.adapter.public.storage.source'
$cachePool: '@flysystem.public' And add in flysystem.yaml : flysystem.cache.adapter:
class: Lustmored\Flysystem\Cache\CacheAdapter
arguments:
$adapter: '@flysystem.adapter.public.storage.source'
$cachePool: '@flysystem.public' ? What about my other adapt regarding aws? And for the cache to be effective with liip_imagine? |
Hi there! To adapt the code from @Lustmored to your app, I think it would look like this:
# config/packages/cache.yaml
framework:
cache:
pools:
cache.flysystem.psr6:
adapter: cache.app (this is the same that we have here: https://symfonycasts.com/screencast/symfony-uploads/cached-s3-filesystem#codeblock-1a69ab8273
# config/services.yaml
services:
# ...
flysystem.cache.adapter:
class: Lustmored\Flysystem\Cache\CacheAdapter
arguments:
$adapter: '@flysystem.adapter.uploads_adapter'
$cachePool: '@cache.flysystem.psr6'
# config/packages/flysystem.yaml
flysystem:
storages:
# ... your other storages
cached_public_uploads_storage:
# point this at your service id from above
adapter: 'flysystem.cache.adapter'
liip_imagine:
# ...
loaders:
flysystem_loader:
flysystem:
filesystem_service: cached_public_uploads_storage
# ...
resolvers:
flysystem_resolver:
flysystem:
filesystem_service: cached_public_uploads_storage
# .... Yes, it IS complex :). This probably won't be quite right - I was reading from source code and typing here, but it should be close. Cheers! |
Okay it works thanks ! @Lustmored Maybe could you upgrade 'psr/cache' to v2 ? |
Thanks @weaverryan for great summary of usage. I must admit I'm not using this adapter in my main project so it was very helpful. I have updated README. @bastien70 I have published 0.2.0 with only significant change being allowing psr/cache 1|2|3 👍 |
Very good mens ! thank you both, everything is perfect now, and long live this super useful bundle! <3 |
Just to say thank you so much @weaverryan and @Lustmored for your work and help! and one question: Thanks a lot |
Hello, Sorry for asking a question in a closed issue, but I wonder if you can further explain the usage. For example, lets say I have an aws adapter, now I want to use the cached adapter for that aws adapter, how should I do it? Do I define the aws adapter service separate and pass the bucket, and client option to it? |
Hello, I would like to integrate your adapter into my Symfony project to combine it with FlySystem and LiipImagineBundle. But I don't understand how to use your adapter?
The text was updated successfully, but these errors were encountered: