You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pdb.go
    path of file: ./repos/mylg/peeringdb
    
    the code of the file until where you have to start completion: package peeringdb

import (
	"encoding/json"
	"fmt"
	"github.com/olekukonko/tablewriter"
	"io/ioutil"
	"net/http"
	"os"
	"regexp"
	"strconv"
	"time"

	"github.com/mehrdadrad/mylg/cli"
)

const (
	// APINetIXLAN holds net ix lan API
	APINetIXLAN = "https://www.peeringdb.com/api/netixlan"
	// APINet holds net API
	APINet = "https://www.peeringdb.com/api/net"
)

// A Peer represents peeringdb record
type Peer struct {
	Name    string `json:"name"`
	ASN     int    `json:"asn"`
	Status  string `json:"status"`
	Speed   int    `json:"speed"`
	IPAddr4 string `json:"ipaddr4"`
	IPAddr6 string `json:"ipaddr6"`
}

// A Net represents peeringdb net reco
    
func cache(r, typ string, data interface{}) (interface{}, bool) {
	switch r {
	case "write":
		b, err := json.Marshal(data)
		if err != nil {
			return nil, false
		}
		err = ioutil.WriteFile("/tmp/mylg.pdb."+typ, b, 0644)
		if err != nil {
			return nil, false
		}
	case "read":
		b, err := ioutil.ReadFile("/tmp/mylg.pdb." + typ)
		if err != nil {
			return nil, false
		}
		if typ == "ix" {
			var res Peers
			err := json.Unmarshal(b, &res)
			if err != nil {
				return nil, false
			}
			return res, true
		}
		// net type
		var res map[string]Net
		err = json.Unmarshal(b, &res)
		if err != nil {
			return nil, false
		}
		return res, true
	case "validate":
		f, err := os.Stat("/tmp/mylg.pdb." + typ)
		if err != nil {
			return nil, false
		}
		d := time.Since(f.ModTime())
		if d.Hours() > 96 {
			return nil, false
		}
	}

	return nil, true
}