hi team , I am working on my custom module in whi...
# help
c
hi team , I am working on my custom module in which i publish that data for redis , but i am anable to un publish data from redis , i am tking reffrence from ProductOptionStorage module in which they have publish and unpublish two function but unpublish they are not using any where so how they are unpublishing data from redis.
w
It depends. Most Storage Modules check in the publish method if the storage entry is still valid and if not will delete them from the storage table in the DB, which automatically triggers a delete in the redis storage. E.g.: Product Concrete publishing takes into account if
spy_product.is_active = true
, if not the
spy_product_concrete_storage
entry is remove d via Propel ORM (https://github.com/spryker/product-storage/blob/1.36.1/src/Spryker/Zed/ProductStorage/Business/Storage/ProductConcreteStorageWriter.php#L198). Another option is to trigger the unpublish event and subscribe your unpublish method to it (e.g.: https://github.com/spryker/product-storage/blob/1.36.1/src/Spryker/Zed/ProductStor[…]ation/Plugin/Event/Subscriber/ProductStorageEventSubscriber.php). Most times you want see anything that triggers the unpublish event, as there is another unpublish event on the ORM level that is more commonly used (e.g.: https://github.com/spryker/product-list-search/blob/2.5.0/src/Spryker/Zed/ProductL[…]on/Plugin/Event/Subscriber/ProductListSearchEventSubscriber.php). Those events are generated by the event-behavior module (e.g.: https://docs.spryker.com/docs/scos/dev/back-end-development/data-manipulation/data-publishing/handle-data-with-publish-and-synchronization.html#[…]s) and have a common naming schema. The naming schema is
Entity.<table>.<event>
(e.g.:
Entity.spy_product.delete
for any delete on the
spy_product
table that is done via Propel ORM)
c
ohk thank you