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

Поділитися
Вставка
  • Опубліковано 10 жов 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

  • @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.

  • @mmsskk1413
    @mmsskk1413 3 роки тому

    Cleared the concept Thanks

  • @syedanwar1872
    @syedanwar1872 2 роки тому

    Thanks for your help and great tutorial

    • @Laratips
      @Laratips  2 роки тому

      You are most welcome

  • @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.

  • @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?

  • @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.

  • @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.

  • @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 ?

  • @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

  • @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,