Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8239039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:00:41+00:00 2026-06-07T20:00:41+00:00

I wonder what is the best way to cache php-output where there is different

  • 0

I wonder what is the best way to cache php-output where there is different content for logged-in users and for those who are guests. “Different” means that guests see less text and no comments and have less functionality on that page (e.g. they cannot mark the current page as favorite).

I could create one file for each “mode” in which a page can be visited. So I would have to check whether a user is logged in or not and then decide which cachefile I serve.
On the other hand I could create only one file for each page and use php-code inside this file to decide which content (or better, how much of it) is printed out.

I would prefer the second option because it would mean that the content or part of the content isn’t stored twice. Furthermore I could be sure that no user could access the complete content by just calling the cachefile (it uses hash in the name anyway). However I’m not that sure if I included all relevant facts in my consideration.
I’d like to know if I missed some (dis-)advantages or other possible methods.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:00:43+00:00Added an answer on June 7, 2026 at 8:00 pm

    i would prefer the first way, it also gives you the ability to cache those views differently eg. when a new comment is added only the member cache need to be rerendered; also the second forces you to generate code, and include later, sounds like php-selfmodifying-code, hell to debug

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I design a database, I always wonder if there is a best way
I wonder how is the best way to integrate Java modules developed as separate
I wonder that what is the best way of writing a component for joomla
I wonder if there is a reasonable easy way to allow for this code
I always wonder about the best way to access a class attribute from a
I wonder what is the best way to measure the execution time of some
I wonder - what is the best way to supply contextual (i.e. not related
i'm start to learn unit testing. i wonder what is the best way to
I wonder what's the best way to write a modular extension of an existing
I wonder what is the best way to test a method that only checks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.