TheShop
  • Home
    • TheShop: Headless e-commerce platform with API-first approach
  • GETTING STARTED
    • Quickstart guide
  • frontstore
    • Introduction
      • Types of frontstores
    • API
      • Frontstore API
      • Template customization
    • API client for Laravel
      • Example: Find products by keyword and include sold out products with available attributes to filter
    • Basic selling flow
      • Homepage
      • Product list
      • Product detail
        • Availability and count info in products
        • Add products to cart
        • Variants tree
      • Shopping cart (Basket)
        • Shopping cart list
        • Voucher (discount code)
      • Shipping and payment
      • Checkout
        • Completing order – payment flow
    • Contact form
    • Headless CMS
    • Caching
    • Known Issues
    • FAQ
Powered by GitBook
On this page
  • Webhooks
  • Frontstore
  1. frontstore

Caching

Webhooks

TheShop uses a pulling system (webhooks) to inform the fronstore about a content change. For each action, you can set up this webhook in settings.

After the webhook URL for your frontstore is present, and changes in administration were made, TheShop sends a request to defined webhook URL.

For example, theshopdev/frontstore uses Cache::rememberForever method to cache static content, so homepage categories are cached forever to reduce API loads.

Frontstore

On the frontstore side, there is a route called /reset-cache, which, by default, accepts a token parameter that you can set up anyhow you want – in .env file, it is provided as CACHE_RESET_TOKEN, to keep this channel secured.

This route checks for a token. If an incoming webhook contains a valid token, cache on the frontstore is flushed. If it does not contain a valid token, the response to server is 400 - Bad request.

This endpoint is a basic implementation and you can develop it in your on way. For example, flush only desired contents based on the webhooks you define.

PreviousHeadless CMSNextKnown Issues

Last updated 2 years ago