Skip to content

Commit

Permalink
Added initial outline and interfaces.
Browse files Browse the repository at this point in the history
This is the initial outline of the caching proposal, including the
interfaces themselves (which are the most fleshed out part of this
being added to the repo at the moment).
  • Loading branch information
tedivm committed Feb 25, 2012
1 parent 3b127b3 commit 9b1a7f5
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions proposed/PSR-Cache.md
@@ -0,0 +1,85 @@
##Introduction
##Goal
##Interface
###CacheFactory

namespace PSR\Cache;

   interface CacheFactory
   {

/**
       *
        * @param string $key
        * @return CacheItem
        */
        function getCache($key);
   }


###CacheItem

   namespace PSR\Cache;

   interface CacheItem
   {
       /**
        *
        * @return mixed
        */        
       function get();

       /**
        *
        * @param mixed $value
        * @param int $ttl
        * @return bool
        */        
       function set($value, $ttl = null);

       /**
        *
        * @return bool
        */
       function isMiss();

       /**
        *
        * @return mixed
        */
       function clear();
   }

##Examples
##Extensions
###Namespaces
###Tags
###Drivers

   namespace PSR\Cache;

   interface Driver
   {    
       /**
        *
        * @param array $key
        * @return array|false
        */        
       function retrieve($key);

       /**
        *
        * @param array $key
        * @param array $data
        * @param int $expiration
        * @return bool
        */        
       function store($key, $data, $ttl);

       /**
        *
        * @param null|array $key
        * @return bool
        */
       function clear($key = null);
   }

0 comments on commit 9b1a7f5

Please sign in to comment.