SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict bronze trophy Hall of Famer's Avatar
    Join Date
    Apr 2013
    Location
    Ithaca
    Posts
    370
    Mentioned
    6 Post(s)
    Tagged
    2 Thread(s)

    Memcache and Membached extensions not bundled with PHP?

    I never knew this was the true, but now it seems to be a problem. As a software developer, I cannot assume all my client users are on hosting services that enable PECL extensions installation. Since Memcache and Memcached both require installation through PECL, this is becoming a headache. For those of you developing commercial/free softwares, how do you resolve this problem? Is it possible to achieve good caching without Memcache/Memcached? If so, what are the alternatives?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,250
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Maybe the PEAR Cache Lite package?

  3. #3
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    There are a lot of options. You can use Memcache, Apc, XCache (windows only), MySQL, a key/value store like MongoDB, Redis, etc, PHP arrays (not as effective as they are gone once the request stops, but within the request they can speed things up), or even flat files.

    The most modular thing to do is write a caching mechanism on a higher level, that has "adapters" for different services. Depending on what's available on the server, use a different adapter.

    A good example of this is how lithium (li3) does it. See http://lithify.me/docs/lithium/storage/Cache
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  4. #4
    SitePoint Addict bronze trophy Hall of Famer's Avatar
    Join Date
    Apr 2013
    Location
    Ithaca
    Posts
    370
    Mentioned
    6 Post(s)
    Tagged
    2 Thread(s)
    I thought Memcache and APC are not bundled with PHP and requires PECL installation, while as a software developer you cannot assume users all have Memcache or APC enabled. Unless you are talking about a different Memcache/APC than I know of? Weird...

  5. #5
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Hall of Famer View Post
    I thought Memcache and APC are not bundled with PHP and requires PECL installation, while as a software developer you cannot assume users all have Memcache or APC enabled. Unless you are talking about a different Memcache/APC than I know of? Weird...
    No we're talking about the same thing. What I suggest is checking the server when your app starts and then use a mechanism that is available.
    So first check if Memcache is available (using class_exists). If it is available, use it. If not, check if APC is available. If it is, use it. If not, check for the next thing. And so on and so forth.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  6. #6
    SitePoint Addict bronze trophy Hall of Famer's Avatar
    Join Date
    Apr 2013
    Location
    Ithaca
    Posts
    370
    Mentioned
    6 Post(s)
    Tagged
    2 Thread(s)
    I see, thanks for your explanation. I guess most shared hosts will not have Memcache, although I wonder how many of them enable APC. What do you mean by MySQL though? Its not a caching system, is it?

  7. #7
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Hall of Famer View Post
    I guess most shared hosts will not have Memcache, although I wonder how many of them enable APC.
    Most of the good ones have one or another, though like hosting it will be a shared resource and not a dedicated instance.

    Quote Originally Posted by Hall of Famer View Post
    What do you mean by MySQL though? Its not a caching system, is it?
    Its an RDBMS but you can use it for caching as well if none of the usual caching engines work. You can create a memory based table to cache data (like you would in an in-memory storage like MongoDB, or Memcached etc), just be sure not to store ton of it as shared hosting accounts have a strict limitation on how much RAM they can juice off. If memory storage is not available in MySQL then you can just go for a regular MyISAM based table and store key-value pairs.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •