Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Reworking of Filesystem handler #57

merged 2 commits into from

2 participants


This is a reworking of the filesystem handler to make some of the code more clear, primarily in an attempt to deal with bugs like that in issue #54.

@tedivm tedivm Rewrote Filesystem->getDataFromFile file for clarity
Reworked the code to make it clearer, and expanded on comments.

Why not simply create a cachefile like this:

return array('data' => 'some-data', 'expire' => 5787545);

And include it in the adapter class:

$data = require_once $cachePath.'/somecacheid.cache';

@Baachi, that's essentially what I do, although for performance and other resource I just directly assign the variables and include them, rather than returning values. I'm not sure if there would be any benefit to changing it (but could be missing something).

@tedivm tedivm merged commit 677de25 into master

1 check passed

Details default The Travis build passed
@tedivm tedivm deleted the data_bug branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 27, 2012
  1. @tedivm

    Rewrote Filesystem->getDataFromFile file for clarity

    tedivm authored
    Reworked the code to make it clearer, and expanded on comments.
Commits on Feb 26, 2013
  1. @tedivm

    Fleshed out comments.

    tedivm authored
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 1 deletion.
  1. +22 −1 src/Stash/Driver/FileSystem.php
23 src/Stash/Driver/FileSystem.php
@@ -132,7 +132,28 @@ static protected function getDataFromFile($path)
- return !isset($data) && !@is_null($data) ? false : array('data' => $data, 'expiration' => $expiration);
+ // If the item does not exist we should return false. However, it's
+ // possible that the item exists as null, so we have to make sure that
+ // it's both unset and not null. The downside to this is that the
+ // is_null function will issue a warning on an item that isn't set.
+ // So we're stuck testing and surpressing the warning.
+ // Item exists
+ // isset + is_null = true + false = true
+ if(isset($data))
+ {
+ return array('data' => $data, 'expiration' => $expiration);
+ // Item is null
+ // isset + is_null = false + true = true
+ }elseif(@is_null($data)){
+ return array('data' => null, 'expiration' => $expiration);
+ }
+ // Item does not exist
+ // isset + is_null = false + notice/false = false
+ return false;
Something went wrong with that request. Please try again.