| 213 | */ |
| 214 | |
| 215 | Expression_cache::result Expression_cache_tmptable::check_value(Item **value) |
| 216 | { |
| 217 | int res; |
| 218 | DBUG_ENTER("Expression_cache_tmptable::check_value"); |
| 219 | |
| 220 | if (cache_table) |
| 221 | { |
| 222 | DBUG_PRINT("info", ("status: %u has_record %u", |
| 223 | (uint)cache_table->status, (uint)ref.has_record)); |
| 224 | if ((res= join_read_key2(table_thd, NULL, cache_table, &ref)) == 1) |
| 225 | DBUG_RETURN(ERROR); |
| 226 | |
| 227 | if (res) |
| 228 | { |
| 229 | if (((++miss) == EXPCACHE_CHECK_HIT_RATIO_AFTER) && |
| 230 | ((double)hit / ((double)hit + miss)) < |
| 231 | EXPCACHE_MIN_HIT_RATE_FOR_MEM_TABLE) |
| 232 | { |
| 233 | DBUG_PRINT("info", |
| 234 | ("Early check: hit rate is not so good to keep the cache")); |
| 235 | disable_cache(); |
| 236 | } |
| 237 | |
| 238 | DBUG_RETURN(MISS); |
| 239 | } |
| 240 | |
| 241 | hit++; |
| 242 | *value= cached_result; |
| 243 | DBUG_RETURN(Expression_cache::HIT); |
| 244 | } |
| 245 | DBUG_RETURN(Expression_cache::MISS); |
| 246 | } |
| 247 | |
| 248 | |
| 249 | /** |
no test coverage detected