From 49019f3988abc3e404dc793797490a9c9a9f406e Mon Sep 17 00:00:00 2001
From: Mac_Weber <Mac_Weber@789986.no-reply.drupal.org>
Date: Fri, 6 Apr 2012 15:09:25 +0000
Subject: [PATCH] improve_static_cache_comments-422352-21

---
 core/includes/bootstrap.inc |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 9e2c875..463ebcd 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2991,13 +2991,23 @@ function registry_update() {
  * }
  * @endcode
  *
- * In a few cases, a function can have certainty that there is no legitimate
- * use-case for resetting that function's static variable. This is rare,
- * because when writing a function, it's hard to forecast all the situations in
- * which it will be used. A guideline is that if a function's static variable
- * does not depend on any information outside of the function that might change
- * during a single page request, then it's ok to use the "static" keyword
- * instead of the drupal_static() function.
+ * In cases where drupal_static needs to be called from a singleton class, the
+ * naming scheme "__CLASS__ . '::' . __METHOD__" should be used in place of
+ * "__FUNCTION__".
+ *
+ * If more than one variable needs to be cached, append each name to the
+ * function or method name with a ':' character, as in the following example.
+ *
+ * Example:
+ * @code
+ * $some_var = &drupal_static(__FUNCTION__ . ':some_var');
+ * @endcode
+ *
+ * Programmers should provide the ability to reset static function variables
+ * unless there can be no legitimate use-case for resetting them. A guideline
+ * is that if a function's static variable does not depend on any information
+ * outside of the function that might change during a single page request, then
+ * it's ok to use the "static" keyword instead of the drupal_static() function.
  *
  * Example:
  * @code
@@ -3108,6 +3118,8 @@ function &drupal_static($name, $default_value = NULL, $reset = FALSE) {
  *
  * @param $name
  *   Name of the static variable to reset. Omit to reset all variables.
+ *   This parameter should never be omitted; except in extreme cases where all
+ *   data is being reset, such as with simpletest.
  */
 function drupal_static_reset($name = NULL) {
   drupal_static($name, NULL, TRUE);
-- 
1.7.0.4

