Add some doc

This commit is contained in:
gwenn 2015-12-19 17:14:06 +01:00
parent 5876be3d48
commit 68b4943a39

View File

@ -5,13 +5,17 @@ use std::collections::VecDeque;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use {Result, Connection, Statement}; use {Result, Connection, Statement};
/// Prepared statements cache. /// Prepared statements LRU cache.
#[derive(Debug)] #[derive(Debug)]
pub struct StatementCache<'conn> { pub struct StatementCache<'conn> {
conn: &'conn Connection, conn: &'conn Connection,
cache: RefCell<VecDeque<Statement<'conn>>>, // back = LRU cache: RefCell<VecDeque<Statement<'conn>>>, // back = LRU
} }
/// Cacheable statement.
///
/// Statement will return automatically to the cache by default.
/// If you want the statement to be discarded, you can set the `cacheable` flag to `false`.
pub struct CachedStatement<'c: 's, 's> { pub struct CachedStatement<'c: 's, 's> {
stmt: Option<Statement<'c>>, stmt: Option<Statement<'c>>,
cache: &'s StatementCache<'c>, cache: &'s StatementCache<'c>,