Index: /code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc
===================================================================
--- /code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc	(revision 7228)
+++ /code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc	(revision 7229)
@@ -61,5 +61,19 @@
             return TclBind::eval(command, error);
         else
-            return CommandExecutor::evaluate(command).query(error);
+        {
+            CommandEvaluation evaluation;
+            if (!CommandExecutor::getInstance().getCached(command, evaluation))
+            {
+COUT(0) << "evaluate" << std::endl;
+                evaluation = CommandExecutor::evaluate(command);
+                CommandExecutor::getInstance().cache(command, evaluation);
+            }
+            else
+            {
+COUT(0) << "cached" << std::endl;
+            }
+
+            return evaluation.query(error);
+        }
     }
 
@@ -97,3 +111,45 @@
         return evaluation;
     }
+
+    bool CommandExecutor::getCached(const std::string& command, CommandEvaluation& evaluation)
+    {
+        if (Shell::getCacheSize() == 0)
+            return false;
+
+        std::map<std::string, CacheEntry>::iterator it = this->cache_.find(command);
+        if (it != this->cache_.end())
+        {
+            // update ordered list of cached commands (move it to the front)
+            this->cachelist_.erase(it->second.iterator_);
+            this->cachelist_.push_front(command);
+            it->second.iterator_ = this->cachelist_.begin();
+
+            // assign the cached evaluation
+            evaluation = it->second.evaluation_;
+            return true;
+        }
+        return false;
+    }
+
+    void CommandExecutor::cache(const std::string& command, const CommandEvaluation& evaluation)
+    {
+        if (Shell::getCacheSize() == 0)
+            return;
+
+        // push command to the front of the ordered list
+        this->cachelist_.push_front(command);
+
+        // create a cache entry and store it in the cache
+        CacheEntry entry;
+        entry.evaluation_ = evaluation;
+        entry.iterator_ = this->cachelist_.begin();
+        this->cache_[command] = entry;
+
+        // remove the last command in the ordered list from the cache if it exceeds the maximum size of the cache
+        if (this->cachelist_.size() > Shell::getCacheSize())
+        {
+            this->cache_.erase(this->cachelist_.back());
+            this->cachelist_.pop_back();
+        }
+    }
 }
Index: /code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.h
===================================================================
--- /code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.h	(revision 7228)
+++ /code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.h	(revision 7229)
@@ -32,4 +32,6 @@
 #include "core/CorePrereqs.h"
 
+#include <map>
+#include <list>
 #include <string>
 
@@ -65,4 +67,16 @@
 
             static CommandExecutor& getInstance();
+
+            bool getCached(const std::string& command, CommandEvaluation& evaluation);
+            void cache(const std::string& command, const CommandEvaluation& evaluation);
+
+            struct CacheEntry
+            {
+                CommandEvaluation evaluation_;
+                std::list<std::string>::iterator iterator_;
+            };
+
+            std::map<std::string, CacheEntry> cache_;
+            std::list<std::string> cachelist_;
     }; // tolua_export
 } // tolua_export
Index: /code/branches/consolecommands3/src/libraries/core/command/Shell.cc
===================================================================
--- /code/branches/consolecommands3/src/libraries/core/command/Shell.cc	(revision 7228)
+++ /code/branches/consolecommands3/src/libraries/core/command/Shell.cc	(revision 7229)
@@ -46,4 +46,6 @@
     _SetConsoleCommand("debug",   OutputHandler::debug  );
 
+    unsigned int Shell::cacheSize_s;
+
     Shell::Shell(const std::string& consoleName, bool bScrollable)
         : OutputListener(consoleName)
@@ -99,4 +101,5 @@
             .callback(this, &Shell::commandHistoryOffsetChanged);
         setConfigValueGeneric(this, &commandHistory_, ConfigFileType::CommandHistory, "Shell", "commandHistory_", std::vector<std::string>());
+        SetConfigValue(cacheSize_s, 32);
 
 #ifdef ORXONOX_RELEASE
Index: /code/branches/consolecommands3/src/libraries/core/command/Shell.h
===================================================================
--- /code/branches/consolecommands3/src/libraries/core/command/Shell.h	(revision 7228)
+++ /code/branches/consolecommands3/src/libraries/core/command/Shell.h	(revision 7229)
@@ -113,4 +113,7 @@
             void setPromptPrefix(const std::string& str);
 
+            static inline unsigned int getCacheSize()
+                { return Shell::cacheSize_s; }
+
         private:
             Shell(const Shell& other);
@@ -167,4 +170,5 @@
             std::vector<std::string>  commandHistory_;
             int                       softDebugLevel_;
+            static unsigned int       cacheSize_s;
     };
 }
