Laravel Tip - Cache The Entire Response And Make Your App Load Faster

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024
  • In this video, we will use laravel middleware to cache the entire response and make our website much faster. Instead of caching some part of our application like MySQL queries, we will cache the entire response.
    Social Media Links:
    Let's be friends
    / aashish_dhamala
    Follow On Facebook
    / laratipsofficial
    Follow On Twitter
    / laratips1
    Tech stack:
    Laravel
    PHP
    MySQL
    #laravel #php #laraveltip #laratips #mysql

Комментарии • 40

  • @syedanwar1872
    @syedanwar1872 2 года назад

    Thanks for your help and great tutorial

    • @Laratips
      @Laratips  2 года назад

      You are most welcome

  • @mmsskk1413
    @mmsskk1413 3 года назад

    Cleared the concept Thanks

  • @maazktk2755
    @maazktk2755 3 года назад

    best video on cache i ever seen. Thank you :)

  • @md.arifurrahman8965
    @md.arifurrahman8965 Год назад

    Great! How about the dynamic pages? like - insert, update, delete. I hope you got my point. where content are changing dynamically regularly.

    • @Laratips
      @Laratips  Год назад

      You can make use of cache tags in that case.

  • @senthur251
    @senthur251 3 года назад +2

    Great Video!! Thanks for sharing!! Can we get to know what are the VS Code extensions are you using?

    • @Laratips
      @Laratips  3 года назад +2

      I am using these extensions for laravel:
      Laravel Blade formatter
      Laravel Blade Snippets
      Laravel Extra Intellisense
      Laravel goto view
      Laravel-goto-controller
      PHP Intelephense
      PHP Namespace Resolver

    • @senthur251
      @senthur251 3 года назад +1

      @@Laratips Thank you so much!!

    • @Laratips
      @Laratips  3 года назад +1

      You are welcome

  • @khageshtiwari99
    @khageshtiwari99 2 года назад

    Great Video... Can we know which tool you use at the bottom of the browser to check number of queries.

    • @Laratips
      @Laratips  2 года назад

      It's laravel Debugbar package

  • @iarsalanbhai
    @iarsalanbhai 2 года назад +1

    Great video but you didnt tell us how to remove cache ? since the system is not reaching to the controller !!! For example after update I want to call clear cache method ..

    • @Laratips
      @Laratips  2 года назад

      The update is done on the admin section and you can easily call cache:clear command from the controller where you have updated the data. Then you will get fresh data on the front-end.
      But lets say if you want to clear the cache for the specific page then you can make use of cache tags. You can check laravel docs for that.

  • @edreesabobker7616
    @edreesabobker7616 3 года назад

    Thanks for great videos. Please can you create video on multi auth in laravel 8 jetstream and two factor auth with laravel 7 .

    • @Laratips
      @Laratips  3 года назад +1

      Jetstream does not support multiauth. We can use laravel breeze.
      Sure, i will make a video on the two factor auth in the future. Stay tuned.

    • @prakashpokhrel9912
      @prakashpokhrel9912 3 года назад +1

      No sir...jetstream can also support multiauth

    • @Laratips
      @Laratips  3 года назад +2

      Great, if you have an working example please share. It will be beneficial for us all.

  • @ashrafmoaidh4513
    @ashrafmoaidh4513 3 года назад

    Great video, Thank you!!
    Can you tell me what tools you use in the browser?

    • @Laratips
      @Laratips  2 года назад

      Lol. I just noticed the comment today. The tool is called "laravel debugbar" 😅

  • @iliyasmsc
    @iliyasmsc 2 года назад

    Cache update if request will be changed?

  • @sarder2008
    @sarder2008 2 года назад

    What if when new data is saved and we need to renew the cache?

    • @Laratips
      @Laratips  2 года назад

      You can make use of cache tags. Just invalidate the tag when there is new data and it will load fresh page.

  • @radhee9554
    @radhee9554 3 года назад

    brother tyo console ko debugger ko name k ho?

  • @AhsanHabib-vt2dq
    @AhsanHabib-vt2dq 2 года назад

    is it works for HTML ???

    • @Laratips
      @Laratips  2 года назад

      You don't need this for html.

    • @AhsanHabib-vt2dq
      @AhsanHabib-vt2dq 2 года назад

      @@Laratips actually i mean just for blade template in laravel, where i used pure html. Thanks to you it works, but how can i use cache tag for data change time from database???

    • @Laratips
      @Laratips  2 года назад

      ​@@AhsanHabib-vt2dq I am sorry, I couldn't understand what you mean to say. Could you make it a little bit clear plz?

    • @AhsanHabib-vt2dq
      @AhsanHabib-vt2dq 2 года назад

      @@Laratips i already used your process and it works but i cannot update the cache when i changed data in database. How i update cache with new html data when i will update database?

    • @Laratips
      @Laratips  2 года назад

      You can pass tag name from the middleware and then clear the cache based on the tag. You can check the laravel docs to know more about tags: laravel.com/docs/9.x/cache#cache-tags

  • @JohnnyBigodes
    @JohnnyBigodes 3 года назад +1

    Guys dont forget to delete the cache, when there was a change in the database.

    • @Laratips
      @Laratips  3 года назад

      Thanks for your input.
      Yes absolutely. But I think we can and the database name and connection in the cache key as well so that we don't have to remember to clear the cache.

    • @bashardlaleh2110
      @bashardlaleh2110 3 года назад

      @@Laratips as per my knowledge database name and connection are fixed ! what do you mean exactly ?

  • @itsaronq
    @itsaronq 3 года назад +1

    Cache::remember?

    • @Laratips
      @Laratips  3 года назад +2

      Thanks for mentioning. Yes we can use this instead of checking for cache and then returning.

    • @itsaronq
      @itsaronq 3 года назад

      @@Laratips it's much more efficient I guess,