Module: Thoth::Plugin::Tags

### Home Classes Methods

### In Files

- lib/thoth/plugin/thoth_tags.rb

### Methods

- ::top_tags

### Files

- robots.txt

### Class/Module Index

Quicksearch

- Thoth
- Thoth::AdminController
- Thoth::ArchiveController
- Thoth::Comment
- Thoth::CommentApiController
- Thoth::CommentController
- Thoth::Config
- Thoth::Error
- Thoth::Importer
- Thoth::MainController
- Thoth::Media
- Thoth::MediaController
- Thoth::MinifyController
- Thoth::Page
- Thoth::PageApiController
- Thoth::PageController
- Thoth::Pager
- Thoth::Plugin
- Thoth::Plugin::Delicious
- Thoth::Plugin::Flickr
- Thoth::Plugin::Tags
- Thoth::Plugin::Twitter
- Thoth::Post
- Thoth::PostApiController
- Thoth::PostController
- Thoth::SchemaError
- Thoth::SearchController
- Thoth::Tag
- Thoth::TagApiController
- Thoth::TagController
- Thoth::TagsPostsMap
- Ramaze
- Ramaze::Dispatcher
- Ramaze::Dispatcher::File
- Ramaze::Helper
- Ramaze::Helper::Admin
- Ramaze::Helper::Cookie
- Ramaze::Helper::Error
- Ramaze::Helper::Pagination
- Ramaze::Helper::Sanitize
- Ramaze::Helper::Wiki
- Ramaze::Helper::Ysearch
- Ramaze::Helper::Ysearch::SearchError
- AddMediaSize
- CreateSchema
- PantsImporter
- PoseidonImporter

No matching classes.

# Thoth::Plugin::Tags

Tags plugin for Thoth.

### Public Class Methods

top_tags(limit = 10) click to toggle source

Gets an Array of the most heavily-used tags. The first element of the array is a Tag object, the second element is the number of times it's used.

    # File lib/thoth/plugin/thoth_tags.rb, line 48
    def top_tags(limit = 10)
      cache = Ramaze::Cache.value_cache

      if tags = cache["top_tags_#{limit}"]
        return tags
      end

      tags    = []
      tag_ids = TagsPostsMap.group(:tag_id).select(:tag_id => :tag_id,
          :COUNT[:tag_id] => :count).reverse_order(:count).limit(limit)

      tag_ids.all {|row| tags << [Tag[row[:tag_id]], row[:count]] }
      cache.store("top_tags_#{limit}", tags, :ttl => Config.tags.cache_ttl)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.