Skip to content

Cannot utilize cache #27

Closed
Closed

Description

@jakiestfu

My apologies for asking what seems like such a trivial question, but I cannot use the cache functionality. "Class 'CachedHttpClient' not found", I don't believe the autoloader is loading everything? Any suggestions?

$github = new Github\Client(new CachedHttpClient(FilesystemCache('/tmp/github-api-cache')));

Activity

  1. gquemener commented on Jan 12, 2013

    @gquemener
    Contributor

    Mmh

    Yeah should work as long as you don't forget use statements and the new before FilesystemCache('/tmp/github-api-cache')

  2. jakiestfu commented on Jan 12, 2013

    @jakiestfu
    Author

    My full code is as follows:

    <?PHP
    
    $cache = true;
    
    $path = APP_DIR.'libraries/github/vendor/autoload.php';
    require($path);
    
    if($cache){
        $github = new Github\Client(new CachedHttpClient(FilesystemCache('/tmp/github-api-cache')));
    } else {
        $github = new Github\Client();
    }
    
    
    
    $github->getHttpClient()->setOption('user_agent', 'GitHub Mobile');
    
    if(_s('token')){
        @$github->authenticate(_s('token'), Github\Client::AUTH_URL_TOKEN);
    }

    My included files [after the autoloader) directly after requiring the autoloader:

    Array
    (
        [4] => app/libraries/github/vendor/autoload.php
        [5] => app/libraries/github/vendor/composer/autoload_real.php
        [6] => app/libraries/github/vendor/composer/ClassLoader.php
        [7] => app/libraries/github/vendor/composer/autoload_namespaces.php
        [8] => app/libraries/github/vendor/composer/autoload_classmap.php
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions