PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/framework/vendor/swift/lib/classes/Swift/KeyCache.php

http://zoop.googlecode.com/
PHP | 99 lines | 16 code | 14 blank | 69 comment | 0 complexity | 1b77a5ee8bfb7cf3ab529a34f8bf765e MD5 | raw file
 1<?php
 2
 3/*
 4 * This file is part of SwiftMailer.
 5 * (c) 2004-2009 Chris Corbyn
 6 *
 7 * For the full copyright and license information, please view the LICENSE
 8 * file that was distributed with this source code.
 9 */
10
11//@require 'Swift/InputByteStream.php';
12//@require 'Swift/OutputByteStream.php';
13
14/**
15 * Provides a mechanism for storing data using two keys.
16 * @package Swift
17 * @subpackage KeyCache
18 * @author Chris Corbyn
19 */
20interface Swift_KeyCache
21{
22  
23  /** Mode for replacing existing cached data */
24  const MODE_WRITE = 1;
25  
26  /** Mode for appending data to the end of existing cached data */
27  const MODE_APPEND = 2;
28  
29  /**
30   * Set a string into the cache under $itemKey for the namespace $nsKey.
31   * @param string $nsKey
32   * @param string $itemKey
33   * @param string $string
34   * @param int $mode
35   * @see MODE_WRITE, MODE_APPEND
36   */
37  public function setString($nsKey, $itemKey, $string, $mode);
38  
39  /**
40   * Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
41   * @param string $nsKey
42   * @param string $itemKey
43   * @param Swift_OutputByteStream $os
44   * @param int $mode
45   * @see MODE_WRITE, MODE_APPEND
46   */
47  public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os,
48    $mode);
49  
50  /**
51   * Provides a ByteStream which when written to, writes data to $itemKey.
52   * NOTE: The stream will always write in append mode.
53   * If the optional third parameter is passed all writes will go through $is.
54   * @param string $nsKey
55   * @param string $itemKey
56   * @param Swift_InputByteStream $is, optional
57   * @return Swift_InputByteStream
58   */
59  public function getInputByteStream($nsKey, $itemKey,
60    Swift_InputByteStream $is = null);
61  
62  /**
63   * Get data back out of the cache as a string.
64   * @param string $nsKey
65   * @param string $itemKey
66   * @return string
67   */
68  public function getString($nsKey, $itemKey);
69  
70  /**
71   * Get data back out of the cache as a ByteStream.
72   * @param string $nsKey
73   * @param string $itemKey
74   * @param Swift_InputByteStream $is to write the data to
75   */
76  public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is);
77  
78  /**
79   * Check if the given $itemKey exists in the namespace $nsKey.
80   * @param string $nsKey
81   * @param string $itemKey
82   * @return boolean
83   */
84  public function hasKey($nsKey, $itemKey);
85  
86  /**
87   * Clear data for $itemKey in the namespace $nsKey if it exists.
88   * @param string $nsKey
89   * @param string $itemKey
90   */
91  public function clearKey($nsKey, $itemKey);
92  
93  /**
94   * Clear all data in the namespace $nsKey if it exists.
95   * @param string $nsKey
96   */
97  public function clearAll($nsKey);
98  
99}